Checking Websockets with curl
2021, Dec 07
Naturally the curl command doesnt allow the ability to curl websockets. example:
$ curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: testexample.com:80" \
--header "Origin: http://testexample.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://testexample.com:80/
You can copy this and replace testexample.com with the hostname of your choice and you’ll see all the websocket data you need.
Credits and shoutout to this Gist on GitHub for the original snippet.