vi/websocat

send a message and listen for incoming messages

GopherJ opened this issue · 3 comments

echo '{"type": "subscribe", "address":"xxx"}' | RUST_LOG=error websocat ws://127.0.0.1:50051/ws
vi commented

websocat ws://127.0.0.1:50051/ws --preamble '{"type": "subscribe", "address":"xxx"}' ?

ls84 commented

What is the difference between the two? I am guessing use --preamble '{"type": "subscribe", "address":"xxx"}' will tell websocat to wait for connection is fully established? It will be great if this is explained. When I echo jsonrpc message it is always a Parse Error

vi commented

The main difference is that echo | websocat allows only one message and closes the connection after it (possibly after printing reply message) and --preamble specifies automatic initial message, then continues to read more messages from stdin.