/gnost-deflate-client

go nostr client implementing permessage-deflate websocket compression

Primary LanguageGoGNU General Public License v3.0GPL-3.0

gnost-deflate-client

go nostr client implementing permessage-deflate websocket compression. Downloads the results of a REQ query, saving the results in jsonl format, and logs to stderr some stats related to the compression.

Building

In cloned repository run go build . to build the executable gnost-deflate-client.

Running

Accepts an array of filter json objects on stdin, and saves the returned events to a .jsonl file:

echo '[{
"authors":["3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"],
"since":1676600000
}]' | ./gnost-deflate-client --port 443 --scheme wss --host nos.lol --output events.jsonl

Keep connection alive

Use the --keepalive N option to keep the connection alive, sending a PING frame to the relay every N seconds. New returned events will be appended to the --output file. Enter C-c to cleanly shutdown the listener.

Compatibility with relays

Set the output to - in order to print the returned events to stdout. This can be composed with the import command for a local instance of gnost-relay or strfry

echo '[{"since":1676863922,"kinds":[1]}]' |\
gnost-deflate-client --port 443 --scheme wss --host nos.lol --keepalive 30 --output - |\
DATABASE_URL=postgres://x gnost-relay --import
echo '[{
"authors":["3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"],
"since":1676600000
}]' | ./gnost-deflate-client --port 443 --scheme wss --host nos.lol --output - | strfry import

Note that strfry import is not compatible with --keepalive since strfry expects an EOF from stdin.