I want to limit access to dashboard ui to only one user from external device. Is this possible and how?
I have a RPI 4 and touch screen on device. When RPI is boots opens opens chromium in kiosk mode so we have full screen dashboards ui showing on device.
One user at a time (not relevant which one). Node red server should only allow one external session at the same time.
External device in local network (device connected to Wifi) such as browser on phone or PC.
Yes, 1 session runs on machine itself (where node red server runs) another session on phone or PC. I need to have interlock among them. If someone change something on PC or phone the interface on machine should be disabled that time.
When a user connects to the dashboard, the UI-Control nodes output a connect event. Similarly, when a dashboard tab is closed, they send a close event. I believe messages sent to the front end from your flow, if they have a socketid property, will only be sent to that specific socket.
You could therefore build a function, which logs all connected socketid's and removes them if a close event is detected. When a new ID is connected, you can send a message to all other sessions triggering a popup, or try push them onto a 'locked' tab with no interaction possible. When the 'live' user disconnects, the last connected one can be re-enabled.
You could also use a switch node, or custom function to filter data being returned from the UI to the flow to only listen to things from the most recently connected socketid.