Quote (OnChair @ Sep 22 2022 09:54pm)
^laztheripper do you know how to receive notifications in a reliable way?
Ok, here goes
Had to add push notifs on a domain of mine. Turns out it's a bit of a fucky system.
Push notifs will be handled by a background service worker, even when the tab or page isn't up at the time, or if the tab is open but not the one in focus.
A different handler will receive the notifs when the page is up. Both the service worker and the on-site handler behaviors are tailored by the site admin.
Now, if all of this is configured correctly and the notif is received by one of these handlers, that still does NOT mean the user will see a popup for it.
1) The user can deny adding the SW, and the browser will refuse to show the "while active" notif if permission wasn't granted. This is kinda moot, cause he obviously allowed them
2) Windows has global notification settings, these need to be allowed
3) Windows has per Application (chrome, edge, etc) settings, these also need to be allowed
4) Windows has Do not disturb modes, which again you can disable.
5) Notifications, depending on what payload they have, can have a TTL where they won't show if you don't view them within a certain time.
6) The notif system in windows will stop showing you notifs of a certain source once enough of them haven't been interacted with (ie: click, dismiss, etc)
7) Sometimes the notif is there, in the notif panel, but the popup doesn't show up. Could be for any of the above reasons.
Windows/Phones used to be a bit better with actually displaying notifs, but as the sheer volume of notifs increased over the years, filtering became a bit more stringent.
The irc is probably more reliable than the push system in terms of speed and ease of access.
But it does go down more often, and your phone/desktop won't show you a notif unless you have it open in the browser.
The most reliable way to receive notifs from jsp would be to register a service worker with your own code, that forwards the data to something that isn't so fickle as windows.
Or write a browser extension that keeps the irc open at all times and forces notifs through without FCM/GCM.
TL:DR Blame the OS, especially windows 10+ (so if anything is wrong, I'd go looking at the windows settings first)This post was edited by laztheripper on Sep 23 2022 02:12am