Last active
March 25, 2026 18:35
-
Star
(247)
You must be signed in to star a gist -
Fork
(70)
You must be signed in to fork a gist
-
-
Save htp/fbce19069187ec1cc486b594104f01d0 to your computer and use it in GitHub Desktop.
Test a WebSocket using curl.
This file contains hidden or 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 --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/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just got to know about this so posting here to help others
WebSocket has been supported by curl as a non-experimental feature since version 8.11.0 (November 6 2024). With the upcoming release of version 8.16.0, we are taking it a step further.
With that release, you can use WebSocket in a pipe from the command line. Like this:
This command line contacts the “echo” server run by websocket.org which just sends back what it receives from the client. The command line options are: