This server will relay any data posted to it's http socket to whichever websocket clients are connected, making it useful for a variety of tasks.
-
node.js
-
ws
$ npm install ws
-
Install the depenencies
$ npm install
-
Run the app
$ node app.js
-
Included are sample nginx and upstart configuration files. You will need to update both configuration files to match your specific instalation:
-
nginx.conf:
Update line 14 to the correct IP address of the server allowed to post data to the relay.
13: … 14: allow <add-controlling-address-here>; 15: …
-
upstart.conf:
Update line 9 to the correct directory of the location of app.js
8: … 9: env RELAY_ROOT=/webapps/relay 10: …
-
-
Symlink in both services repsective configuration files:
sudo ln -s /path/to/root/nginx.conf /etc/nginx/sites-available/relay.conf sudo ln -s /path/to/root/upstart.conf /etc/init/relay.conf
-
Start both services:
sudo service relay start sudo service nginx start
-
You should now be able to post to /send and any websocket clients connected will recieve any posted data.