Re: [w3c/push-api] Make PushSubscription.expirationTime mandatory (#302)

@collimarco 

I was thinking about checking `subscription` for each specific time so that server always has the new one.  regarding my question 3)

What if in my service worker's `pushsubscriptionchange`, I call `fetch` api call and if it fails, in a `catch` block, I put `newSubscriptionTriggered:true` in the indexeddb. 

Way 1) what we could do is use `setInterval` in service worker and check `indexeddb` and if it has `newSubscriptionTriggered:true` in there, call the `fetch` api again . If it fails, we do nothing as another interval would kick in. If it succeeds, we remove `newSubscriptionTriggered:true` from the indexeddb. The following `setInterval` call wouldn't call `fetch` as there's no `newSubscriptionTriggered:true` in there.

Way 2)  What we could do is instead of using `setinterval` in service worker, we could do that check in our app code. and do the same. The downside of it is that what if user doesn't go to our website for some time and `pushsubscriptionchange` 's `fetch` failed.  It means that new subscription won't be saved to db until user checks our website again where I check `indexeddb`'s  `newSubscriptionTriggered:true` and call `fetch` again. 

Way 3) don't use `indexeddb` at all and in app code,  we check somehow when to run the code which grabs `subscription` again and send it to the server. But this also has a downside.  I think Way 1) should be the optimal solution.

What do you think, Marco ? 

-- 
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/302#issuecomment-622505492

Received on Friday, 1 May 2020 18:27:46 UTC