w3c / push-api

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

Define behaviour of pushsubscriptionchange in the event of an error #205

Closed benlast closed 7 years ago

benlast commented 8 years ago

When I say "the spec", I'm referring to https://w3c.github.io/push-api/#the-pushsubscriptionchange-event.

It's not defined that a pushsubscriptionchange event will be fired when the browser has network connectivity, and of course it's also possible that any given network request may fail for a variety of reasons.

In a pushsubscriptionchange event handler, it may be a common requirement for the service worker to update new subscription details to some application server. It's not clear how to handle the case of a failure in the network upload.

As a suggestion; If the network Promise is included in event.waitUntil, and the Promise rejects, the event may be re-sent to allow the service worker code to retry.

Otherwise, the event handler code must flag that a retry is required, and wait for some opportunity to retry the upload. However, it's not clear what opportunity it will get. Since the spec says that any old subscription is unsubscribed on completion of the pushsubscriptionchange event, no further push events may be expected, and there is no guarantee that there will be any other event (such as install or activate) fired.

benlast commented 7 years ago

I see this is effectively included in Kit Cambridge's response at https://github.com/w3c/push-api/issues/132#issuecomment-225308850 so I'm closing this issue.