Hi everyone,
I'm currently working on modifying the ui_base.js file onConnection method to manage socket connections for the Node-RED Dashboard. Specifically, I want to achieve the following:
On api/login: Allow the creation of socket connections for the user.
On api/logout: Destroy all associated UI socket connections for that client.
To implement this effectively, I need to locate the source code responsible for socket generation and management within the Node-RED core or the Dashboard module. Does anyone know where this functionality resides? Any pointers or guidance on which files or functions handle socket creation and cleanup would be greatly appreciated.
Thanks in advance for your help!
Which dashboard ? 1 or 2 ?
I can't see this being a good idea to be honest since it fragments the core design of D2 unless you have some agreement to do a pull request to integrate the change back to core?
Also, this could be done externally without having to make changes to D2.
And, it might not be a great idea anyway given that D2 is currently a single-page app so cutting off all comms means no interaction at all with users. you would have to force them to go to a different web page to log in and then, if successful, would have to change pages again to put them back into D2.
I can't really help with the D2 specifics as I don't really use it. I would note that UIBUILDER has middleware features for both per-connection and per-message so already has touch points for this. You could also do a much more nuanced approach simply by adding msg filters to the input and output so allowing limited communications to take place and allowing the login/logout process to stay in a single-page arrangement if that is desired).
Could you please share some multi tenant example socket flow.json for reference.
How could I handle the socket connection for multi tenancy in a more effective way
using the socket in and out node.