Crates.io | nostcat |
lib.rs | nostcat |
version | 0.3.3 |
source | src |
created_at | 2022-11-18 14:37:44.905549 |
updated_at | 2022-12-10 10:58:28.822291 |
description | Websocket client for nostr relay scripting |
homepage | |
repository | https://github.com/blakejakopovic/nostcat |
max_upload_size | |
id | 717921 |
size | 36,118 |
Websocket client for nostr relay scripting
Using interactive input
$ nostcat wss://relay.damus.io <return>
["REQ", "RAND", {"kinds": [1], "limit": 8}] <return>
<ctrl-D>
Using stdin (supports multiple lines of commands)
$ echo '["REQ", "RAND", {"kinds": [1], "limit": 8}]' |
nostcat wss://relay.damus.io
$ cat commands.txt
["REQ", "RAND", {"kinds": [1], "limit": 2}]
["REQ", "RAND2", {"kinds": [2], "limit": 2}]
$ cat commands.txt | nostcat wss://relay.damus.io
Using jq to query Nostr JSON events and select the event JSON
$ echo '["REQ", "RAND", {"kinds": [1], "limit": 8}]' |
nostcat wss://relay.damus.io |
jq '.[2]'
$ echo '["REQ", "RAND", {"kinds": [1], "limit": 8}]' |
nostcat wss://relay.damus.io |
jq '.[2].content'
Unique (dedupe) results as they come in (note: no longer applies sorting events - FIFO)
$ echo '["REQ", "RAND", {"kinds": [1], "limit": 8}]' |
nostcat --unique wss://relay.damus.io wss://nostr.ono.re
With a websocket connection timeout in milliseconds
$ echo '["REQ", "RAND", {"kinds": [1], "limit": 2}]' |
nostcat --connect-timeout 250 wss://relay.damus.io
Stream websocket data (like tail -f)
$ echo '["REQ", "RAND", {"kinds": [1], "limit": 8}]' |
nostcat --stream wss://relay.damus.io
Output info log messages which can assist with debugging
$ echo '["REQ", "RAND", {"kinds": [1], "limit": 8}]' |
RUST_LOG=info nostcat wss://relay.damus.io
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])' |
nostcat wss://nostr.ono.re
Pipe events from one server to another (for multiple events, ctrl-C
when finished)
$ echo '["REQ", "CID", {"limit": 3}]' |
nostcat wss://relay.damus.io |
jq -c 'del(.[1])' |
nostcat --stream wss://nostr.ono.re
<ctrl-C>
Using Cargo to install (requires ~/.cargo/bin to be in PATH)
$ cargo install nostcat
Building from source (may be unstable)
$ git clone https://github.com/blakejakopovic/nostcat
$ cargo build --release