Closed jb55 closed 1 year ago
Now supported in v0.3.0. Updated examples in the README.md
Sort and unique results with multiple servers (dedupe)
$ echo '["REQ", "RAND", {"kinds": [1], "limit": 8}]' |
nostcat --unique wss://relay.damus.io wss://nostr.ono.re
Pipe events from one server to another (currently limited to 1 event at a time)
echo '["REQ", "CID", {"limit": 1}]' | nostcat wss://relay.damus.io |
jq -c 'del(.[1])' |
wss://nostr.ono.re
Let me know how it goes :) I am aware of a bad/failed to connect hang issue where there isn't a connection timeout for servers yet - but likely my next focus.
should unique be the default? I can't imagine not using that flag.
I'm not against it. I was thinking more modular + composable, and how perhaps just piping to | sort -u
is good enough? Perhaps there are more complex de-duping or sorting use-cases that involve parsing the JSON events, which currently isn't done. I don't know how consistent nostr server's output the JSON keys (or perhaps drop keys, like special tags) for example - maybe this cannot be relied upon long term. Thoughts?
In testing, for example, it was nice to know that I actually received 30 events across servers (without --unique
, however it was 12 events with, and some servers returned the exact same as they must be replicating). Maybe not useful for others, outside of testing/debugging, but setting it as the default would kill that ability to compare.
On Sat, Nov 19, 2022 at 02:14:32AM -0800, Blake Jakopovic wrote:
I'm not against it. I was thinking more modular + composable, and how perhaps just piping to
| sort -u
is good enough? Perhaps there are more complex de-duping or sorting use-cases that involve parsing the JSON events, which currently isn't done. I don't know how consistent nostr server's output the JSON keys (or perhaps drop keys, like special tags) for example - maybe this cannot be relied upon long term. Thoughts?
ah yeah you're right, sort -u should work fine. Dunno why I thought to overcomplicate this.
you should be able to pass multiple relays as an argument to have it query them all at once.
So instead of 1 EOSE/OK we would expect N EOSE/OKs