Basic WebSockets Relay Server
Multiple clients can connect to this WebSockets server. Whenever a message is sent to the server by a client, every other client gets the message. Relay.
Install
npm install -g wsrelay
Starting the Server
The default port used is 8124, although you can pass a port number as an argument.
wsrelay [port]
Connecting with wscat
You can test the server out using wscat, which is like the UNIX cat
command but for websockets.
wscat --connect ws://localhost:8124
Be sure to connect two wscat
s to the server to see it relaying messages.
Writing your own client
Alternatively, you can write your own websocket client in Javascript
var WebSocket = ;var ws = 'ws://localhost:8124'; //print out all relay messages receivedws { var message = evtdata; console;} //send all user input to the relayprocessstdin;