Office Push Push with Angular2

I am trying to summarize the general workflow of providing users with push notifications through a service worker.

I have been following this with Google’s Employer for Push Notification Service Developers, and currently I’m thinking about how I can implement these things with a small user experiment web application.

In my opinion, the overall workflow of a web application that supports push notifications is as follows:

  • Customer visits application
  • Service worker receives push notification endpoint
  • The client sends the endpoint to the server
  • The server associates the endpoint with the current user stating that the endpoint was generated for
  • Each time your application says that the notification deserves attention, the server captures the endpoint (s) of the push notification associated with the user and calls on it to send a push notification to any user devices (possibly with a data payload in Chrome 50+, etc.)

Basically, I just want to confirm that my general thoughts on implementing using this technology are accurate, otherwise get feedback if I missed something.

+6
source share
1 answer

You pretty much bully, there are some features that are not entirely correct (but this is largely formulated and can be done for personal taste).

  • Customer visits application
  • Register the service you want to use for push messages
  • Use the service worker account to sign up for the user to forward messages, after which the user agent will configure the endpoint + additional values ​​to encrypt the payloads (if the user agent supports it).
  • The client sends the endpoint to the server
  • The server stores the endpoint and data for later use (the server can associate the endpoint with the current user, if the server, if the web application has user accounts).
  • When the server wants to send a notification to the user, it captures the corresponding endpoints and calls them, which will awaken the worker who can display the notification.

Support for payloads in Chrome 50+ and while writing the payload is support in Firefox, but there are 3 different encryption versions used for payloads in three different versions of Firefox, so I will wait for the payload support history that needs to be smoothed out a bit. before using / relying on her.

+8
source

All Articles