Skip to content

Instantly share code, notes, and snippets.

@lionants02
Forked from htp/curl-websocket.sh
Last active June 9, 2022 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lionants02/8aa0f7094574588d2193f0e4b64b1ebb to your computer and use it in GitHub Desktop.
Save lionants02/8aa0f7094574588d2193f0e4b64b1ebb to your computer and use it in GitHub Desktop.
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
curl -i -v -o - --http1.1 --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: http://example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://192.168.9.2:20980/socket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment