Node-Red Dashboard Query - Using session ID for multi users

Hi ,

I went through quite a few posts on the forum. And everywhere it says NR Dashboard is single user.
At the same the readme for Dashboard talks about socket id.

My Query :-

So long , I don't maintain the states as part of flow/global/node - contexts and keep the state externally (say DB) and ensure that every query/ click etc. from Dashboard user goes to DB and gets data for his click and keep my socket ID intact when sending the data back - work from 1 user should not interfere with other user right ?

Can someone share an example where despite maintaining socket IDs the work of multiple users interferes each other.

  1. in the flow itself the state of some items eg switch, slider only have one state or value. So if any user changes a switch or moves a slider then the ui should update for all users.

  2. if a user refreshes or reloads a page for any reason then they will get a new socket id. So you somehow have to track that as well.emphasized text

2 Likes

Thank You so much @dceejay .

Clear. Since i am not using this i could not fathom the scenario. All my scenarios have elements sending messages and ui being updated as result of those messages.

So for my scenario - if this happens then i send the user back to Dashboard 0 which is a login page.
(This is done using connect event).
It can be network disruption or user decided to refresh.

This is the intended functionality for now.

FYI - I do keep a note of socket IDs but that's because i need to know the usernames.
This was a later functionality just for some cosmetic benefit.

Background :-
All my dashboards are hidden.
Dashboard 0 is a Login Dashboard. User logs in . Validation is done against external system. Once validated - i store the socket id and user in a map.
On connection lost event - delete it from that map.
In 2-3 places in the flow using msg.socketId get user name from this map.

Initially i was using os.username. But that doesn't work on remote servers - and hence had to maintain this map.

Coming back to the moot query - so it depends on ui elements - for some we cannot show separate behavior for each client. And hence we need to be sure if that element works for us or not.

Clear. Thank You so much for helping me understand. I was v concerned if i have a hidden issue which can blow up anytime.