ws-service

0.1.1 • Public • Published

ws-service

This is a websocket server which will pipe incoming messages to chosen command thorugh standard input and return standard output in turn. This server will run as a os service.

Warning: This was only tested in Windows 10.

Warning: This IS NOT production ready.

Obs.: For commands, be sure to use an elevated console (admin rights).

Prerequisites

  • You MUST be running Windows 10 or Linux (untested).
  • You MUST have up to date Node JS installed.
  • You MUST have up to date NPM installed.
  • If running Windows 10, you must run the following command: npm install --global --production windows-build-tools. Obs.: It may fail sometimes.
  • If running Windows 10, you must ensure Phyton 2.7 (installed in the previous item) is in your Path.

Usage

Step 1

Create a YAML file with the name you want. I will call mine: settings.yml (this one will be used in step 3).

Step 2

In settings.yml, write the following content:

port: 8001
command: echo
args:
  - I am working!
  1. command must contain a a valid shell command.
  2. port defines where the HTTP server will be listening for requests.
  3. args must contain a list of command line arguments.
Step 3

Install the server as a service with the following comands:

npm install -g ws-service
ws-service install my-project "/absolute/path/to/my/settings.yml"
Step 4
  • On Windows, start the server running: net start ws-my-project on elevated shell.
  • On Debian/Ubuntu, start the server running: sudo service ws-my-project start.
Step 5

You will have to setup a little client in your browser to test our work.

Have Questions?

Please, if you have any questions, suggestions, doubts, etc.. Don't hesitate to open issues.

Thanks!

Package Sidebar

Install

npm i ws-service

Weekly Downloads

3

Version

0.1.1

License

ISC

Unpacked Size

7.23 kB

Total Files

4

Last publish

Collaborators

  • gcsboss