vi / websocat

Command-line client for WebSockets, like netcat (or curl) for ws:// with advanced socat-like functions
MIT License
7.18k stars 278 forks source link

Websocat client cannot connect even though wscat does? #244

Closed Aracki closed 6 months ago

Aracki commented 6 months ago

wscat -c ws://node-ethereum:8545 does connect, but websocat ws://node-ethereum:8545 just timeout with

websocat: WebSocketError: I/O failure

How can I debug this type of error? (version websocat 1.13.0)

vi commented 6 months ago

Try capturing a traffic dump. Alternatively, make Websocat log traffic itself.

websocat -t - ws-c:log:tcp:node-ethereum:8545

One of reasons NodeJS-based tool can connect while other tools can't is the lack of permessage-deflate support and forced, unconditional usage of it by server.

Using strace or analogue can also be helpful.


I/O failure

What if you try to use explicit IP address instead of node-ethereum?

Aracki commented 6 months ago

The problem was that websocat doesn't print that it's connected and some of the messages I was sending caused it to return I/O failure 🤦

Sorry, it was working from the beginning. It's just that a find "connected" output more convenient to know if you can start sending messages over websocket like wscat does with -c flag.