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

Re-establish connection after websocket is closed #157

Closed arabelaa closed 2 years ago

arabelaa commented 2 years ago

We are proxying tcp connection to websocket. websocat -b -E ws://host.docker.internal:8888/client tcp:127.0.0.1:5800

I was wondering if there is an option that can re-establish the connection with tcp when the websocket is closed? I saw autoreconnect overlay but that just re-connects the websocket back. I also need to re-establish the connection tcp - websocket.

Is there an option (overlay) to recreate the connection in case the websocket is closed?

Thanks

vi commented 2 years ago

Maybe you just want to run Websocat in a loop?

while true; do websocat -b -E ws://host.docker.internal:8888/client tcp:127.0.0.1:5800; done

If WebSocket close detection is not reliable, you can use --ping-interval and --ping-timeout.

arabelaa commented 2 years ago

Indeed that can be an option. I was just wondering if there was an overlay/flag that I missed.

Thanks.