Web Push Notifications with Web Workers
Here is an example workflow, with the accompanying diagram.
- Browsers asks for permissions to send notification.
- Register your web worker web worker.
- When registration comes back, subscribe to push on the registration object.
- when subscription endpoint comes back from the API, then you need to send this ID to your server.
- Fire off push notifications to the endpoint id from your server (this is the push notification subscription ID).
- Listen in your worker for “push” event and show messages.