Recently, I was searching for the curl of WebSockets.

There are some GUI tools for playing with WebSocket connections, but I prefer the command line.

Turns out, there exists a command line tool that not only implements the client but can also act as a server.

Install it via

npm install -g wscat  

and you're fine.

Now you can connect away:

$ wscat -c ws:// -p 13

You can even run a WebSocket server:

$ wscat -l 8080 -p 13

To sum it up, you can run your local WebSocket session like this:

$ wscat -l 8080 -p 13
$ wscat -c ws://localhost:8080 -p 13

Note: Protocol Version 13 is the default for the server.

Package documentation is available.

Thanks to our friend Sebastian Cohnen for recommending to mention the server feature and explicitly including the protocol version (13).

Blog Logo

Ralf Rottmann

founder of largest german app dev studio. former the next web editor. open web addict and developer at heart.



The Engine Room

thoughts, stories and ideas | from the grandcentrix team

Back to Overview