raix-push
raix-push copied to clipboard
Question: how to deal with abandoned token?
I’ve noticed, that if I uninstall app (without logging out) and than install it again, I’ve got new token in the DB. And system doesn’t delete it even after a while. How to detect those tokens?
I see in code something to remove broken tokens, and actually some of my dev tokens were removed when I tried to send pushes with dev tokens from production servers. But those abandoned tokens stays for ages.
@artpolikarpov this is late but.. I came across the same problem.
I had to change the package, but here: https://github.com/raix/push/blob/464d82469ca15b8579b469b7156a6c9d16874d9b/lib/server/server.js#L4-L10
When the token is bad (value === null), you want to save that token, I would suggest a helper collection, Publish those tokens by userId who is logged in:
Then call the token unregister method like:
Push.push.unregister(successCallback, errorCallback);