nostr:npub1xdtducdnjerex88gkg2qk2atsdlqsyxqaag4h05jmcpyspqt30wscmntxy what black magic did you use to make nsec.app so incredibly persistent in the background when installed as a PWA? Can you help me make cashu.me as persistent as nsec.app so I can make NWC zaps while the wallet is closed / in the background?

Reply to this note

Please Login to reply.

Discussion

He is a dark lord of background tasks

It asks to enable push notifs, then sends the push endpoint to server along with pubkey and relay, server monitors the pubkey on relay for unanswered nip46 messages, when detected sends a push to wake up the service worker.

Nwc flow is quite similar, so it should be possible to have the same thing there.

Server side is https://github.com/nostrband/noauthd - not a beautiful piece of code, but can be an inspiration.

You'll also need strfry or other relay that stores ephemeral events for a while so that woken up service worker could fetch them.

sadly I know too little about push notifications in PWAs.

but on iOS I think this will be hard. There are no silent push notifications and the app has to be active I think.

nostr:npub1kuc70777tsvj67fl75s2dmy376t97hv05xmyuyshzzy6vhj5q5jstv0eyw mention you can bypass it by having a "permanent notification" on iOS which we want to use to allow bitcoin core running on iphones

I just tested some things and was surprised how far the PWA world has come. I could wake my Android phone (display turned off) through a push notification through a PWA. 🤯 Try it yourself:

https://simple-push-demo.vercel.app/