vi / websocat

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

websocat does not report errors when the connection dies #237

Open the-sun-will-rise-tomorrow opened 7 months ago

the-sun-will-rise-tomorrow commented 7 months ago

I'm trying to use websocat to debug a network problem with websockets.

Here is an excerpt from running with -v:

[INFO  websocat::ws_peer] Received WebSocket ping
[INFO  websocat::ws_peer] Received WebSocket ping
[INFO  websocat::ws_peer] Received WebSocket ping
[INFO  websocat::ws_peer] Received WebSocket ping

and then, nothing.

Is the other side not sending ping frames? If so, shouldn't websocat do something, like send its own ping frames, and detect a timeout?

Has the connection been terminated by a FIN or RST? If so, shouldn't websocat print an error message?

If I press Enter, then it exits with websocat: WebSocketError: I/O failure, but it doesn't explain much (#236).

Thanks.

vi commented 7 months ago

If you want Websocat to send pings, use --ping-interval (and maybe --ping-timeout) options. Note that it would send the pings constantly, regardless of incoming data or pings.


Connection termination (especially in the default interactive mode) is indeed a problem in Websocat. Sometimes I need to type two additional messages before it detects that the connection is no longer usable. -E option may help, but may also introduce other problems. --async-stdio likewise can improve latency, but cause other problems.


Related issue about usefulness of Websocat's log messages: #209.