w3c / push-api

Push API
https://w3c.github.io/push-api/
Other
145 stars 40 forks source link

Allow atomic push resubscribe #292

Open aliams opened 6 years ago

aliams commented 6 years ago

I was wondering if we can consider having an atomic resubscribe method for push? Apparently there are sites that unsubscribe and then try to subscribe again and then they lose their subscription if the browser is closed, for instance. It would be ideal if we were able to subscribe another channel and then if it succeeds, we remove the old channel.

After chatting with @beverloo, it sounded like we should have something like PushManager.refreshSubscription() that invokes the refresh algorithm and would return a Promise<void> that'd be resolved when the pushsubscriptionchange event has finished executing.

aliams commented 6 years ago

cc @beverloo

collimarco commented 5 years ago

+1 It would be useful to programmatically trigger a refresh also for testing pushsubscriptionchange. Currently there is no way to test it! Indeed if you block and then allow the notifications you will never get the "refresh" event - the events triggered in this way don't have oldSubscription and newSubscription...

beverloo commented 5 years ago

We are interested in shipping this API.