0
votes

I'm having some series of questions about implementing push notifications. The things are,

  1. I am using Angular for my frontend where am sending my subscription value which is of an object type with key keys like endpoint, auth, etc (is this will be same for every device like mobile, or some other browsers).

  2. Does all the data in that subscription object is mandatory? or only endpoint.

  3. If a user is logged in with more than 10 devices, do I need to store subscription values for each device? is it how it works? Or should I store the last logged in device's subscription value? If so then the rest of 9 won't get any notifications.

  4. If you are storing all the loggedin Device's subscription value, then is a user logged in more than one browser will he get the notification in each browser? Is it a standard practice?

Suggestions are welcome, any standard practices will be helpful.

Thanks in advance

1

1 Answers

2
votes
  1. subscription object has the same format for every web device/browser
  2. yes, for more, see the documentation

    When we want to send a push message to a user with a payload, there are three inputs we need:The payload itself.The auth secret from the PushSubscription.The p256dh key from the PushSubscription.We've seen the auth and p256dh values being retrieved from a PushSubscription but for a quick reminder, given a subscription we'd need these values:

  3. each device has it's own endpoint and auth keys, so if you want to send push to every device user logged in, you need to store all of them
  4. yes, user gets notifications for all browsers, if you call them.( you're making a post request to device's endpoint )