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.
I need help with this! I want to make cashu.me wallet sit in the background and listen for push notifications that are triggered by NWC commands so that the PWA can wake up, send a zap, and go to sleep again.
Who has experience in this? Please hit me up
nostr:nevent1qqs86ydcrey0ykkruevc00wzp2ce2m63yn5yhuftks4ssqt0amlvaqgpremhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet59upzqv6kmesm89j8jvww3vs5pv46hqm7pqgvpm63twlf9hszfqzqhz7aqvzqqqqqqyxqvy4n
It would be great, i have to open the app every time i need to zap someone.
I have implemented Web Push in a variety of apps. Do you have any specific questions or problems?
I think I kind of get the idea but I never implemented such a server and push service. I'm guessing it would also require the app to register with the server so that the server knows which NWC pubkey commands to listen to. Would you be up to working on this together? I think other wallets could benefit from this too.
I looked through my server, there's some irrelevant stuff there that could be removed, and then just change the event kind and it should work. Will make a prototype for you
Awesome thank you, that will be very helpful!
Yes, you'd have to manage Web Push subscriptions on the server issuing the push messages, and store pubkeys per subscription there. I can help you with the actual implementation if you want, but only from Thursday on.
I want an app that tells someone that I used to love that I still love them