Last active
July 7, 2021 19:29
-
-
Save yyolk/d45625ef372890e44d7576d91ccf4966 to your computer and use it in GitHub Desktop.
watch subscribed events to your xrpl node from the command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# install websocat | |
# cargo install --features=ssl websocat | |
# --features=ssl needs to be included to connect to wss:// | |
# we use `<<<` to send a string into the command: | |
# echo '{"command"...}' | websocatt ... | |
# is equivalent | |
# use websocat to call the admin port | |
websocat ws://localhost:6006 -n \ | |
<<< '{"command":"subscribe","streams":["ledger"]}' \ | |
| jq '{txn_count,ledger_index,ledger_hash}' | |
# use websocat to call the default public port, if enabled, with self-signed cert (default with installation) | |
websocat -k wss://localhost:6006 -n \ | |
<<< '{"command":"subscribe","streams":["ledger"]}' \ | |
| jq '{txn_count,ledger_index,ledger_hash}' | |
# when you have the cert in the machine, such as the CA that signed xrplcluster.com, drop `-k` | |
websocat wss://xrplcluster.com -n \ | |
<<< '{"command":"subscribe","streams":["ledger"]}' \ | |
| jq '{txn_count,ledger_index,ledger_hash}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment