-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use add_subscription? #106
Comments
did you make any progress on this. I'm having a hard time working with this -- which is because of my limited understanding & knowledge. But I just don't 'get' what is subscription ID - do I create it? If yes, how. All I've been able to do so far is connect to relays and post a note. I have read and re-read the readme but I still don't get it. Any help would be appreciated. |
I wasn't able to figure it out, so I switched to https://github.com/holgern/pynostr for subscription ID, it can be anything unique |
ok, thanks -- bookmarking it. |
seems to work fine from the examples. |
tbh, I haven't tried it again after the suggestion from @decentropy - will comment here again if I run into issues. Thanks |
Just tested this, and seems to work either before or after: relay_manager.open_connections()
relay_manager.add_subscription(subscription_id, filters)
Yes, that works fine. Here's a complete example: # Setup filters
filters = Filters([Filter(limit=10)])
# Generate subscription
subscription_id = uuid.uuid1().hex
request = [ClientMessageType.REQUEST, subscription_id]
request.extend(filters.to_json_array())
relay_manager = RelayManager()
relay_manager.add_relay("wss://nostr-pub.wellorder.net")
relay_manager.add_relay("wss://relay.damus.io")
relay_manager.add_relay("wss://nostr.wine")
relay_manager.add_relay("wss://nostr.rocks")
relay_manager.add_subscription(subscription_id, filters)
relay_manager.open_connections()
I believe it's whatever the relay returns, based on your filters. So in theory yes - all old events. |
Can I call add_subscription after open_connections, or do I need to do it before like the README example?
Another question... Should I expect to get all old note/events using RelayManager.message_pool.has_event?
I'm having trouble getting any thing, the while-loop just quits. I've even tried simplifying the filter to EventKind.TEXT_NOTE.
The text was updated successfully, but these errors were encountered: