Test WebSocket application with wscat

You can test your WebSocket (WS) application by using wscat -- small nodejs application.

The wscat it is nodejs command line websocket client.


You can install wscat my npm:

npm install wscat  

This command with install wscat into current directory. However you can install it global by using -g option of npm.

Or you can install it via your OS packet manager (e.g. Ubuntu Linux apt).

sudo apt install node-ws  

Run wscat

If you install wscat with npm into local directory (not global) then just run:

nodejs ./node_modules/.bin/wscat -c ws://localhost:8080  

Or if you using apt package:

wscat -c ws://localhost:8080  

This two commands is equal -- it both will connect to yours ws application on localhost and port 8080.