You should be able to pull this out of the ZS core code together with the relays ZS is publishing to.
Hi friendly Nostr devs.
What's the best pattern for push?
I have a server with a db of npubs and push tokens from my app.
If an npub follows another user, and that user goes live, I would push to the npub's token "user is live! heres a link"
Should my server maintain a persistent connection to multiple relays subscribed to all kind 30311s to identify when all lives start?
And, similarly for follow lists, should I persistently subcribe to all kind 3s? (And then wash them against npubs in my db, or perhaps specify 1000 author pubkeys in a req?)
Or some other pattern? It's all seeming quite inefficient and spammy on public relays...
Maybe I am missing an obvious layup e.g. somehow populate my own local relay with all kinds 3 and 30311's and connect locally with impunity?
What pattern have others used? Are there docs on this? #asknostr nostr:nprofile1qqsyvrp9u6p0mfur9dfdru3d853tx9mdjuhkphxuxgfwmryja7zsvhqpzamhxue69uhhv6t5daezumn0wd68yvfwvdhk6tcpz9mhxue69uhkummnw3ezuamfdejj7qgswaehxw309ahx7um5wghx6mmd9u2mk7fe nostr:nprofile1qqsqvcu68pkfcyq5y9mz9n9u7sys33835rpnuglc6mtg7j4lv40c7ugpz4mhxue69uhhyetvv9ujuerpd46hxtnfduhsz9mhwden5te0wfjkccte9ec8y6tdv9kzumn9wshszrnhwden5te0dehhxtnvdakz7k6tgvl 🙏🙏
Discussion
I wonder if it is bad etiquette for my server to maintain multiple 24/7 subscriptions to multiple popular relays ... Or, no worries?
I would have no worries, your server is just acting as a nostr client
That I wouldn't know. But I know that ZS has push notifications so it's in the code somewhere. Maybe take a look to see how Kieran did it. ZScore also has specific relays in the config so I guess it would make sense to use those to find (most) live events.
It's also better for chat across different apps. In fact, we should have dedicated relays for live events. Every app doing different implementations for something that needs to be standardised and work THE SAME across all apps. The current way - some apps - implemented live events and chats basically just sucks and it's very anti-engagement cause nobody ever knows if they can be seen by everyone else.