This simple Node.js application serves the purpose of passing messages between connected TCP and WebSocket clients. Any message received from one of them is automatically passed to all others.
In addition to passing socket data, the application also serves static files located under a given folder. This is useful for serving the actual web application that needs such socket functionality.
When starting the application, you can give it three parameters:
$ ./app.js 80 3000 my/app/folder
There is a simple example provided. To start it, run:
$ ./app.js 80 3000 example
Then connect with a browser to http://localhost.
You also need to telnet to the socket server:
$ telnet localhost 3000
Now anything you write in the telnet session will be shown on the web page instantly.
sockjs.send('My cool message');