Re: [w3c/push-api] Retry push event (#300)

After further investigation, I have noticed that **Background Sync** actually supports a retry mechanism: this [blog post](https://notes.eellson.com/2018/02/11/chrome-the-background-sync-api-and-exponential-backoff/) says that Background Sync can perform retries even when custom exception are raised. Background Sync also waits for the connection to become available before attempting a retry.

I also believe that you can call ServiceWorkerRegistration.showNotification() inside a Background Sync. Am I wrong?

Then the easiest approach to make the processing of the `push` event reliable is this:

1. Call `swRegistration.sync.register('downloadAndDisplayNotifications');`
2. Listen for the `sync` event and when you can successfully download data from the application server you display the notifications using ServiceWorkerRegistration.showNotification()

You already recommend Background Sync for `pushsubscriptionchange`: it would be perfect if we could use Background Sync also for the `push` event (you can also suggest that in the spec).

The **only problem** I can see in this approach is that `userVisibleOnly` will not detect that the `push` event has displayed the notifications. This problem is specific to the Push API: can we find a solution for this?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/issues/300#issuecomment-419468001

Received on Friday, 7 September 2018 15:03:17 UTC