-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sending PN to specific user(s) #3
Comments
Hi there, To be able to send notifications to one or more selected users, three extensions or steps are required:
Extending the client script to transfer an (existing) user ID.Since the service worker runs in a separate thread in the browser that does not have access to the currently active page (or its DOM), the process of subscribing has to be slightly modified in order to pass the user ID (or any further data) to the service worker before it subscribes to the push notifications. In the current code example, the service worker subscribes to the push notifications immediately upon activation and the returned information is then sent directly to the server for storage. This means that it is not possible to pass additional data that can be sent to the server for storage together with the subscription information. Since these changes are a bit more complex, I have them implemented in the following sample scripts:
... it should be noted that these are sample scripts that I didn't have too much time to test for ... The server-side changes/extensions should be feasible according to the comments above ;-) |
Hello, thank you for this awesome module (if I can call it so).
I've set up it successfully and can receive notifications, however, what I'm not figuring out is that how to target a specific user (or users) to send them a notification?
Presumably, I think I'd modify the table to include a unique ID column, but how can I call the desired functions to send PNs WHERE unique ID matches my needs?
Thank you.
The text was updated successfully, but these errors were encountered: