11
Decider / Websockets JSON and Web UI Control Surface Pages
« Last post by Cube on February 20, 2018, 04:16:03 PM »I re-implemented a function today at the request of JH whereby upon registration of one or more VINTs for a Websocket session, Decider will send the current values and Device Status of all registered VINTs to the client in a single JSON object (an array) like so:
Sample Request:
Sample Response:
One thing that occurred to me, and this from a place of ignorance about the way in which JH's node.js web interface works, as he changes pages from one control surface to another, it is possible (likely?) that the client will retain the web socket connection, but need to register for a new set of VINTs (and possible un-register other VINTs) While there would be nothing wrong with keeping them registered, we would simply send values it had no place to display, at present there is no mechanism yet in place to unregister VINTs within a given session. A couple of options lay before me:
I'll probably go with option #1, but is there any other option I am overlooking? Is there an advantage to going with #2 or #3 that is not apparent?
Sample Request:
Code: [Select]
{"RegisterVUIDs":["1","5","9"]}
Sample Response:
Code: [Select]
{"VintValues":[
{"VUID":1,"DeviceStatus":1,"Value":2000},
{"VUID":5,"DeviceStatus":1,"Value":2000},
{"VUID":9,"DeviceStatus":1,"Value":2000}
]}
One thing that occurred to me, and this from a place of ignorance about the way in which JH's node.js web interface works, as he changes pages from one control surface to another, it is possible (likely?) that the client will retain the web socket connection, but need to register for a new set of VINTs (and possible un-register other VINTs) While there would be nothing wrong with keeping them registered, we would simply send values it had no place to display, at present there is no mechanism yet in place to unregister VINTs within a given session. A couple of options lay before me:
- Implement an UnregisterVUIDs command.
- Instruct the client to disconnect and re-connect when a new set of VINT subscriptions is required.
- Do nothing (Keep all registered VINTs in the session and continue to send their updates.
I'll probably go with option #1, but is there any other option I am overlooking? Is there an advantage to going with #2 or #3 that is not apparent?