vi / websocat

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

Connection Error #170

Closed gmonk closed 1 year ago

gmonk commented 1 year ago

I have a device that provides a websocket status display that works fine in the browser but when using websocat i get the following errors (websocat: WebSocketError: WebSocket protocol error websocat: error running)

Here is a capture from chrome dev tools when i connect using the browser..

Request URL: ws://192.168.50.103:8081/ Request Method: GET Status Code: 101 Switching Protocols Connection: Upgrade Sec-WebSocket-Accept: cYb/oiBL1cD7hxC30gbeVKg4dnM= Sec-WebSocket-Protocol: front-panel-protocol Upgrade: WebSocket Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.9 Cache-Control: no-cache Connection: Upgrade Host: 192.168.50.103:8081 Origin: http://192.168.50.103:8081 Pragma: no-cache Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits Sec-WebSocket-Key: UmZp1DKw3J47A0Tr4vCNow== Sec-WebSocket-Protocol: front-panel-protocol Sec-WebSocket-Version: 13 Upgrade: websocket User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

vi commented 1 year ago

Sec-WebSocket-Protocol: front-panel-protocol

Have you used --protocol option of Websocat?

Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

Note that Websocket extensions are not supposed by current version of Websocat. Websocket servers are supposed to avoid using them if Websocket client does not indicate support, but there are some buggy servers around. If this is indeed forced permessage-deflate then unfortunately there is no easy workaround for now.


As it is unencrypted connection, a traffic dump (Wireshark/tcpdump) may help in debugging the issue.

gmonk commented 1 year ago

--protocol front-panel-protocol worked !!!!

Thank you for the help