Hacker News new | ask | show | jobs
by mr_mitm 14 days ago
I'm currently attempting to write a calendar app for personal use, and I wanted to go the route of a self-host PWA. Notifications are a good point. How can I create notifications as a reminder before an event? Alerts are part of the icalendar standard ("VALARM"), so these are clearly notifications that are wanted by the user. Is that even possible for a PWA?
1 comments

You can send notifications with PWAs with Web Push API + Service Worker, same as a regular page.

But, AFAIK, you need the server for push, though. It used to be possible to program entirely from the client with this proposed feature but AFAIK it's abandoned: https://github.com/GoogleChrome/developer.chrome.com//blob/m...

> You can send notifications with PWAs with Web Push API + Service Worker, same as a regular page.

While the app is awake, sure.

I'd like notifications to work even if the OS backgrounded the app, and even without a network connection, like I'd expect a reminder to work.

> https://github.com/GoogleChrome/developer.chrome.com//blob/m...

Looks like this is what I need and it doesn't exist. So the short answer is "no". Thanks for the link!

> While the app is awake, sure.

That's not true. The browser's push service wakes the service worker on delivery, even if the PWA is fully closed. That's the entire point of Push API vs polling.

And the OS will never background the browser for battery optimization reasons? Genuine question, I'm not an expert on mobile OSs (as you already guessed).
The notification daemon lives in a separate process.