Closed collimarco closed 5 years ago
Basically, errors happen and in case you need to replace the applicationServerKey you need to ask to the end users to manually unsubscribe and then resubscribe.
Hi @collimarco! I don't understand why you'd need to ask the user; could you please elaborate? Assuming they haven't revoked permission, you should be able to call getSubscription
, compare keys, and unsubscribe
and subscribe
again on mismatch without a permission dialog popping up, no?
Yes, that is the case on all implementations I'm aware of.
Silently replacing any previous subscriptions feels risky to me - as the developer, you'd want to synchronize such a change with your server. Changing the applicationServerKey
of a subscription is a deliberately decision, and providing some sort of upgrade path for existing subscriptions with that would be reasonable.
I have noticed that updating the applicationServerKey is not easy: you need to ask to the end user to unsubscribe and resubscribe to push notifications.
At Pushpad we have noticed that some developers actually need to change the applicationServerKey, for example because they are migrating from other push services or because they have mixed different applicationServerKey on the same domain. Basically, errors happen and in case you need to replace the applicationServerKey you need to ask to the end users to manually unsubscribe and then resubscribe. It would be much better if pushManager.subscribe could replace the subscription automatically in case the applicationServerKey provided is different from that associated to the existing subscription.