vi / websocat

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

Adding a timeout option for connection #206

Open GuittonHubert opened 7 months ago

GuittonHubert commented 7 months ago

Hello,

Unless already possible using scripts, would it be possible to add a command line option to specify a timeout for the WebSocket handshake, please? The aim is to detect a potential connection failure. In that case, websocat only fails after 60 seconds:

$> websocat -k -vvv --max-messages 0 wss://<url>

[INFO  websocat::lints] Auto-inserting the line mode
[DEBUG websocat] Done third phase of interpreting options.
[DEBUG websocat] Done fourth phase of interpreting options.
[DEBUG websocat] Preparation done. Now actually starting.
...
[INFO  websocat::stdio_threaded_peer] get_stdio_peer (threaded)
[DEBUG websocat::sessionserve] Underlying connection established
[INFO  websocat::ws_client_peer] get_ws_client_peer
websocat: WebSocketError: WebSocketError: Received unexpected status code (504 Gateway Timeout)
websocat: error running

Thank you for your support.