You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 24, 2021. It is now read-only.
Learned something interesting today we need to handle:
In Chrome 43 through Chrome 45 JSON.stringify returns an empty object for PushSubscription objects. The recomended workaround is to reconstruct the object before stringifying, i.e. const fixedSub = { endpoint: sub.endpoint, registrationId: sub.registrationId }
In Chrome 51+ you cannot directly access the keys property on PushSubscription objects but need to JSON.stringify first
Hence I think the best thing to do is something like
I haven't tried it but so far as I can see that should always ensure we get the keys we want working around the bugs and weirdnesses of other versions?
Worth noting that with this solution registrationId will always be a key but will be undefined from the version of Chrome which deprecated it (46 or so?). I suspect the better solution is to deprecate registrationId with respect to this library and thus just remove the extraction of that key from the above.
The text was updated successfully, but these errors were encountered:
Learned something interesting today we need to handle:
const fixedSub = { endpoint: sub.endpoint, registrationId: sub.registrationId }
keys
property on PushSubscription objects but need to JSON.stringify firstHence I think the best thing to do is something like
I haven't tried it but so far as I can see that should always ensure we get the keys we want working around the bugs and weirdnesses of other versions?
Worth noting that with this solution
registrationId
will always be a key but will be undefined from the version of Chrome which deprecated it (46 or so?). I suspect the better solution is to deprecate registrationId with respect to this library and thus just remove the extraction of that key from the above.The text was updated successfully, but these errors were encountered: