WebSockets

BrightSign players fully support WebSocket protocol through Node.js®. Players can act as either the WebSocket server, the WebSocket client, or host both sides to the communication. The URL the client connects to when establishing its connection with the WebSocket server is set statically. The server and client both have knowledge of the IP address for the WebSocket client. Below are two examples for establishing WebSocket communication on BrightSign players.

GitHub Example

Follow the instructions at https://github.com/brightsign/websocket-test to establish a WebSocket connection on a BrightSign player.

When performed properly, the autorun.brs file will automatically establish a Node.js environment on the player, as well as the WebSocket server and WebSocket client. The WebSocket client then sends a message to the WebSocket server on the machine, and the server prints a message on the display.

npm Example

The following example requires knowledge of npm and creating plugins for BrightSign players:

  1. Download the WebSocketSample.zip file.

  2. Using npm, run "npm install" in the directory.

  3. Run "node node_server.js" for the WebSocket server.

  4. Open the index.html file in a browser to establish a connection.

  5. Click on the "Click me" button to send a message back to the WebSocket server.

This example establishes a WebSocket connection on the active machine. In order to perform this on a BrightSign player, a plugin must be used. It is recommended that the plugin uses bsMessagePort to act as a pipeline between itself and JavaScript. For more information, click here.

Remote DWS and WebSocket

BrightSign players running OS8.0.x and later maintain a persistent WebSocket connection to the BrightSign WebSocket server. This connection allows for BSN.cloud Control Cloud functionality where authorized users can view and modify player settings in real time over the Internet.

Server-Side Security

The BrightSign WebSocket server implements a permissions model that ties each player to a single BSN.cloud network via the player serial number. Only a person with the proper network credentials can perform Remote DWS calls through the WebSockets server. Credentials are validated using the same OAUTH 2.0 server as other BSN.cloud applications.

The WebSocket server validates all client data before processing to prevent malicious attacks.

Client-Side Security

Communication between the WebSocket server and BrightSign players is carried out using the secure WebSocket protocol ("wss://"): Messages are encrypted to prevent man-in-the-middle attacks against the player or server. The authenticity of the client (player) is validated using the same OAUTH 2.0 server as other BSN.cloud applications.

The BrightSign player validates all server data before using it to affect player settings. Data from the WebSockets server can also be passed along to an internal UDP port for processing by the client BrightScript/JavaScript application.