I have developed a web app: It's a quiz where two users play against each other in turns. So during a match, it's either user A's or user B's turn. I want to use push notifications (using the Web Push API) to inform a user when their opponent has played and it's their turn.
I'm wondering if there is an optimal way to do this using the technologies at hand (service workers, Push API). And if there isn't an ideal solution, what would be a good compromise?
What I ideally want to achieve (probably impossible):
The complications/limitations are:
time_to_live), there is no way to take back a notification once it is dispatched (is that right?)The easiest approach is to attach a user ID to each subscription and then reach all the devices that belong to a given user. An user tired of duplicated notifications can always block the notifications on some devices.
Also use the TTL (0 or a few minutes) to automatically drop the notifications on the devices that are not connected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With