Service worker

“A service worker is an event-driven worker registered against an origin and a path. Service workers essentially act as proxy servers that sit between web applications, the browser, and the network (when available). They are intended, among other things, to enable the creation of effective offline experiences, intercept network requests and take appropriate action based on whether the network is available, and update assets residing on the server. They will also allow access to push notifications and background sync APIs.” - MDN Web Docs

Our service worker implementation is based only on Push API.

If the user agrees to receive notifications through subscription form, then:

  • service worker is registered in the user's browser,

  • random Subscriber's Token with its VAPID key pair for data encryption is generated by provider and sent through HTTP request to the PushPushGo server,

  • subscriber is saved in the PushPushGo database by giving him an internal Subscriber ID which is returned in response and saved in IndexedDB for further identification,

  • based on HTTP headers, the subscriber is labeled in the PushPushGo database (operating system, language, browser, provider type, location guessed using GeoIPLookup).

In other words, the service worker is responsible for subscriber’s identification and notification delivery.

Last updated