├── README.md ├── autorun.brs ├── index.html └── server ├── package.json └── server.js /README.md: -------------------------------------------------------------------------------- 1 | # websocket-test 2 | A simple example of how to use WebSockets with BrightSign 3 | 4 | This application runs a node.js server on the BrightSign, and uses a local websocket server. 5 | 6 | ## To run it: 7 | 8 | ### Run the server. For example, on your laptop: 9 | * Install NodeJS 10 | * In the "server" directory: 11 | * Run "npm install" 12 | * Run "node server.js" 13 | * Note the IP address of your laptop 14 | * Edit the following line in index.html to reflect the above IP address instead of 10.0.1.1: 15 | 16 | var wsUri = "wss://10.0.1.1:81/"; 17 | 18 | ### Configure your BrightSign player: 19 | * Put the files "autorun.brs" and "index.html" on an SD card 20 | * Connect the BrightSign player to the internet, and power it up 21 | * You should see "RESPONSE: Hi, you sent me WebSocket rocks" on the connected display. 22 | -------------------------------------------------------------------------------- /autorun.brs: -------------------------------------------------------------------------------- 1 | url$ = "file:///sd:/index.html" 2 | 3 | r=CreateObject("roRectangle", 0,0,1920,1080) 4 | is = { 5 | port: 2999 6 | } 7 | config = { 8 | nodejs_enabled: true 9 | inspector_server: is 10 | brightsign_js_objects_enabled: true 11 | hwz_default: "on" 12 | url: url$ 13 | } 14 | h=CreateObject("roHtmlWidget", r, config) 15 | p = CreateObject("roMessagePort") 16 | h.SetPort(p) 17 | h.Show() 18 | while true 19 | msg = wait(100, p) 20 | end while 21 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |