Created
May 12, 2016 11:32
-
-
Save higebu/123794e0a0c3bc98e2fc535df2713cef to your computer and use it in GitHub Desktop.
Test WebSocket with curl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: echo.websocket.org" -H "Origin: https://www.websocket.org" https://echo.websocket.org |
This connects, but do you manage to get the echo service to actually work? On my side I am not seeing the data I enter on stdin being echo'ed:
curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: echo.websocket.org" -H "Origin: https://www.websocket.org" https://echo.websocket.org
HTTP/1.1 101 Web Socket Protocol Handshake
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: content-type
Access-Control-Allow-Headers: authorization
Access-Control-Allow-Headers: x-websocket-extensions
Access-Control-Allow-Headers: x-websocket-version
Access-Control-Allow-Headers: x-websocket-protocol
Access-Control-Allow-Origin: https://www.websocket.org
Connection: Upgrade
Date: Wed, 15 Aug 2018 11:38:15 GMT
Server: Kaazing Gateway
Upgrade: WebSocket
WebSocket-Location: wss://echo.websocket.org/
WebSocket-Origin: https://www.websocket.org
test
lol
^D
^C
wscat -c ws://echo.websocket.org
however works as expected, see https://www.npmjs.com/package/wscat
It would be nice to achieve the same with just curl.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://www.websocket.org/echo.html