- From: Giorgi Lagidze <notifications@github.com>
- Date: Thu, 30 Apr 2020 07:58:21 -0700
- To: w3c/push-api <push-api@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/push-api/issues/302/621907958@github.com>
@collimarco Thanks for your explanation. A couple of things I want to add here . 1) The final idea is that we don't know when browser decides that subscription is valid or not. So we send a request to endpoint from app server and if it returns any code other than 201, we decide to say that this subscription is NOT valid and we remove it from our database. Right? 2) because of the fact that I only let users subscribe to my app when they are logged in, it means that i assign `user_id` to `endpoint`. Turns out in service worker, i can't grab the `user_id` . So only way to send the subscription is without `user_id`. but i don't think that's gonna be a problem, since my api would take the `old` endpoint and find the record with it. If it exists, it replaces it with the new one . Right? 3) Do I still need to have the code which gets called each time user refreshes the page? the code which gets subscription and sends it to the server. Right now, what I have is i only send the subscription if user agreed to that permission and if the subscription couldn't be saved in the database. This makes sure that i only execute sending subscription to my server only one successful time. If I leave the logic this way, the risk is that when `pushsubscriptionchange` gets called, `fetch` might result in an error. `pushsubscriptionchange` won't get called again and I lose the new subscription. What do you think? -- 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-621907958
Received on Thursday, 30 April 2020 14:58:33 UTC