0.0.7 • Published 4 years ago

websocket-remote-control-server-test v0.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

websockets-remote-control-server

This library initializes the Websockets server. Maintains a list of connected clients, in addition to running validations and listening to events.

When a client connects (through a socket), the server is attentive of the following events:

  • getSpecialNumber: Sends the socket id and the Special Number to the screen. The Special Number is an auto-generated token used for pairing both devices.

  • linkController: Validates that the screen and the controller are correctly paired.

  • alreadyLinked: Emits an event alerting the involved sockets that the client which is trying connect is already paired.

  • data: Validates that the data received is an url and is from an existent client. If the validation is correct, the data is sended to the client.

Installation

npm install websockets-remote-control-server

(tentative)

Usage

After installing the library:

Create and run a web server. You can use Express following our example.

Require the websockets-remote-control-server and initialize it:

// app.js (in our example)

let WebControlServer = require('websocket-remote-control-server');
let webcontrol = new WebControlServer(server);

And done! Now, you should install and use the client library to be able to listen and answer to the previously listed events.

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago