Comments (2)
10.5 The pushsubscriptionchange Event
The pushsubscriptionchange event indicates a change in a push subscription that was triggered outside of the application's control, for example because it has been refreshed, revoked or lost.
To fire the "pushsubscriptionchange" event given a service worker registration of registration, newSubscription and oldSubscription, the user agent must fire a functional event named "pushsubscriptionchange" using PushSubscriptionChangeEvent on registration with the following properties:
- newSubscription
- oldSubscription
NOTE
Consider using a more reliable synchronization mechanism such as [WEB-BACKGROUND-SYNC] when sending the details of the new push subscription to your application server. The user might be subject to unreliable network conditions that could cause a fetch to fail.
-- https://w3c.github.io/push-api/#the-pushsubscriptionchange-event
10.5.2 PushSubscriptionChangeEventInit Interface
dictionary PushSubscriptionChangeEventInit : ExtendableEventInit {
PushSubscription newSubscription = null;
PushSubscription oldSubscription = null;
};
The newSubscription member details the push subscription that is valid per invocation of the pushsubscriptionchange event. The value will be null when no new push subscription could be established, for example because the web application has lost express permission.
The oldSubscription member details the push subscription that SHOULD NOT be used anymore. The value will be null when the user agent is not able to provide the full set of details, for example because of partial database corruption.
-- https://w3c.github.io/push-api/#pushsubscriptionchangeeventinit-interface
So I see following reasons why our code doesn't work:
- it doesn't handle unreliable network conditions
- it doesn't handle cases where
oldSubscription
is null ornewSubscription
is not null - it doesn't even get called or is never called with any data since it's still not supported by a lot of browsers
The last point is the most likely the issue, so I guess we need a workaround and can't rely on this event listener. Here is a post from 2019 how to do this.
from stacker.news.
Pretty impressive how unsupported it still is 4 years later.
from stacker.news.
Related Issues (20)
- Add popover support for markdown links to sn items `[]()`
- Search anomaly, is ":" in the title throwing something off?
- Comments non-deterministically missing after submission HOT 7
- Set a reasonable boost max HOT 1
- Can't withdraw sats to Alby Extension HOT 2
- Addition of Naira(NGN) to fiat currencies
- "Unable to get image fees" HOT 1
- Sats forwarded to anon don't go to rewards HOT 1
- Feature Request: Arrows to flip through photos HOT 2
- Prevent new account creation from /login
- Add 'This day on SN' to empty /search page
- Limited rights for "anon" account HOT 2
- Syntax highlighting HOT 9
- Territories have statistics for dates they didn't exist yet HOT 2
- Make dependence on web assembly optional HOT 3
- Top Cowboys page has territory selector which doesn't actually do anything
- Text Overflowing Out Of Bounds For "invoice canceled" Notification HOT 5
- Pull down to refresh on iOS
- No territories on mobile HOT 6
- Undefined comment root in profile items HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stacker.news.