Skip to content

Instantly share code, notes, and snippets.

@htp
Last active November 9, 2025 06:11
Show Gist options
  • Save htp/fbce19069187ec1cc486b594104f01d0 to your computer and use it in GitHub Desktop.
Save htp/fbce19069187ec1cc486b594104f01d0 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/
@enderandpeter
Copy link

This was very helpful. Thanks so much. In my case I just needed to confirm that the websocket server could be connected to and the connection would be upgraded, but I see how the headers and other settings can be changed as needed for any particular situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment