For multi-tenancy purpose, I'm exploring the use of '_client.socketIp' instead of '_client.socketId' for maintaining UI state across tab changes in a multi-tenant environment.
Currently, all my UI-template nodes are being cleared when switching tabs frequently. Would an IP-based approach provide better persistence, triggering multi-tenancy only for new IPs regardless of socket changes?
Has anyone implemented this or can share insights on potential drawbacks?
I'm specifically looking at the "ui-template" node under Client Data.
Attached is what I'm trying to do - the "ui-template" is checked, under Client Data.
I'm building a multi-page dashboard starting with a login page, using ui-template nodes with Client Data enabled to toggle between pages. I'm tracking SocketID changes and how it's clearing UI data accordingly.
From the flow below, my steps are:
Enter Email/Password → 2. Populate → 3. Refresh → 4. Previous → 5. Next Page (manually).
The goal is to maintain UI state across tab changes in a multi-tenant setup. I'm concerned about frequent SocketID resets clearing data unexpectedly. I've attached an example flow below for reference. Any suggestions on improving persistence would be appreciated.
Thanks again!
You should also note that IP addresses can change unexpectedly depending on the environment.
For example, in an enterprise or even a home setup, a laptop might go from a wired to a wireless connection or visa versa and in doing so, the IP address may change.
So really, neither Socket ID nor IP address are really reliable sources of client information.
It is for this reason that UIBUILDER adds both a clientID and a tabID. The clientID is created as a UUID and retained for as long as the browser stays alive (so survives devices being put into sleep or hibernation) and is unique across all tabs in a single browser instance (which includes multiple windows of course). The tabID is created by the browser itself. These are made available to Node-RED and the client for maximum versatility. Neither of these id's are impacted by network changes or devices/tabs going to sleep.