David - Musings of an SRE

Debugging Websockets with wscat (Websocket CLI Terminal)

So I’m currently working on a Websocket implementation from almost-scratch (Tornado/Websockets) and I’m working on implementing some form of rooms/channel functionality. This is mostly just for my learning experience to dive deeper into Python.

A cool tool that I’ve just discovered is helping me shave off the time needed to do debugging to a bare minimum.

Introducing wscat, a nodejs cli application that allows you to connect directly to a websocket server and receive/send data in a terminal like environment.

With just a simple

$ npm install -g ws

and a

$ wscat -c ws://path/to/websocketserver

I get a nice looking interface to send and receive websockets.

wscat-screen

yay!

p/s: I heard you can even start a server

$ wscat -l 9999