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
For context, I'm looking to use ember-service-worker to facilitate push notifications using the PushSubscription API.
My app has a service which is responsible for maintaining user session information, and I would like to expose that session service to the service worker, so that it can map push subscriptions to a specific user. I imagine this is a fairly common pattern for folks who are looking to use service workers for the purpose of push subscriptions, however the documentation seems geared solely towards using service workers for the purpose of making apps offline first.
The text was updated successfully, but these errors were encountered:
Instead of relying on postMessage, I would either store it in Local Storage or IndexedDB if it's not sensitive data, or fetch it from the server if it is. The SW has free access to IDB and LS.
Why would you not use postMessage? Browser support?
Using the server does not really make sense to me for push notifications, since you would then need a push notification from the server that it has a message ;)
But LocalStorage (or SessionStorage) seems like a good alternative with the window.addEventListener('storage', function(event) {}) option.
For context, I'm looking to use ember-service-worker to facilitate push notifications using the PushSubscription API.
My app has a service which is responsible for maintaining user session information, and I would like to expose that session service to the service worker, so that it can map push subscriptions to a specific user. I imagine this is a fairly common pattern for folks who are looking to use service workers for the purpose of push subscriptions, however the documentation seems geared solely towards using service workers for the purpose of making apps offline first.
The text was updated successfully, but these errors were encountered: