Currently all ui changes will be emitted to every client that is online.
I have modified ui.js and events.js so that you may control which client should receive which message.
There are lots of use cases where this is mandatory I believe. Assume the following simple use case:
You are showing the production status of certain production lines in your plant.
Person ‘A’ wants to see the status of line ‘A’, person ‘B’ wants to see the status of line ‘B’.
The dashboard itself is the same of course, it just receives different data (line A or line B).
Implementation:
Change in events.js / ui.js:
I am adding the socket.id to the message data sent from the client (events.js) to the server (ui.js). In my sample test-flow I am “injecting” the nodes that should only update one client rather than emit to everyone. Basically I am injecting a property ‘meOnly’ to the nodes’ config.
ui.js may then decide, based on the node being processed, whether to emit to all clients or to the one with the matching socket id.
This is a first, simple implementation – I very much suggest to include that mechanism to the core, as it opens a lot more scenarios that could be implemented. In future releases authentication, e.g. via passport, could be added as well.
Who ever wants to play with it, I have put my code changes on gist:
https://gist.github.com/pelis/b0366fefd8c33c7953f5efa6439b5a1aHello,
yes, that's exactly the use-case I had in mind, you have one Dashboard which displays somthing based on a user selection.
e.g.
When user A wants to see the Dashboard for "Region A" I don't want that user B will also see "Region A" - he should still see whatever his selection is (now, even his selection gets changed).
For future scenarios, this could even be used to incorporate authorization capabilities such as passport (but that is out of scope for now I guess).