PWA Notifications

zenen
2024-07-24T01:46:29Z

Building my first Progressive Web App, it's new territory for me but I've made it installable already.

I'm trying to cover a fairly simple use case, which is displaying a badge count based on the number of unread notifications. Intuition tells me that I'd just ping an endpoint on the server at a 5 minute interval, but I'm in new territory so I thought I'd open up the conversation to see if there's any gotchas to be aware of.

I'd like to see if there's anyone out there on Tildes who has experience in this domain - is the service-worker always on, or is it only active once the app has been open and then backgrounded? How do I know if the app is currently open? I would like the app to query for notifications more frequently when it's opened, and only intermittently when it's closed. Any tips?

Comments URL: https://tildes.net/~comp/1hs5/pwa_notifications

Votes: 8

Comments: 9