Skip to content
Advertisement

410 push subscription has unsubscribed or expired

Our web push notification was just working fine but recently we noticed that the end points are expiring in less than one day and when we try to send notification initially it was going just fine but later it stopped delivering and when we checked we found that it was giving status code 410

the message was

410 push subscription has unsubscribed or expired

we searched google and found several links which says we need to resubscribe every time the link expire by sending old and new tokens and save that in db but the problem is we have huge no of subscriber and doing that for every one is not tenable. above all people will not open site again and again and if resubscribe can be achieved only when customer opens site again then lots of end points will be dead as people rarely return to site again and again except few very popular sites.

so is there any way we can update the new endpoints by exchanging the old endpoints through php at server end without depending on clients?

they have already subscribed to we have their end points which expired.

or is there anyway we can extend the expiry of generated endpoints at very first place?

Advertisement

Answer

You must listen to the pushsubscriptionchange in the service worker, otherwise you will lose all the subscribers after some time: the subscriptions have a duration and then are replaced automatically.

You can see a real example of pushsubscriptionchange definition here:

https://pushpad.xyz/service-worker.js

Then on the server you need to replace the old endpoint with the new one.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement