#http #terminal #tools

Here's how to test a websocket connection using cURL:

1$ curl --include \
2       --no-buffer \
3       --header "Connection: Upgrade" \
4       --header "Upgrade: websocket" \
5       --header "Host: example.com:80" \
6       --header "Origin: http://example.com:80" \
7       --header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
8       --header "Sec-WebSocket-Version: 13" \
9       http://example.com:80/

Just replace example.com with the hostname of your choice and you'll see all the websocket data passing by…

Credits to this Gist on GitHub for the original snippet.