Repository navigation
Push notifications go missing on the macOS web app #416
Styry
started this conversation in
Bug reports
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Setup: Campfire 1.5.6 installed as a web app on macOS (Safari 26.5), plus an iPhone. Messages come from a bot. The iPhone got every push. The Mac often got none, while Apple returned 201 for every delivery. I found three separate causes.
A minimized window stays present after a reconnect. With the window minimized, the membership's
connected_atkept updating every ~50 s, so no push was sent to any device. Subscribing toPresenceChannelmarks the member present (on_subscribe :present), and#websocketConnectedstarts the refresh timer without checking visibility, so after a reconnect nothing sendsabsent. Fix: in#websocketConnected, start the timer only when visible, otherwise sendabsent.The service worker calls
waitUntilafter anawait.waitUntilhas to be called while the event is dispatched, and here the notification also fails if the badge update fails. With the app closed it worked; with the app open the notification didn't show. CallingwaitUntilsynchronously and showing the notification before the badge fixed that:badge_dot_controllercallssetAppBadge/clearAppBadge, and macOS took the notification away. Updating the badge from the page only while the window is focused, and recounting on focus, fixed it. While unfocused the push already sets the badge.We also treat an unfocused window as away for presence (
document.hasFocus()), so switching to another app gets you pushes. That one is more of a preference.Patches are small, happy to open PRs for any of these.
All reactions