Dashboard 2: ui-control node multiple connect/change/lost events

Hello:

Converting from DB1 to DB2... I have a ui-control node that is set to "Connection Events Only" (name = Connect) and another one "Page/tab Change Events Only" (name = Refresh Tab). What appears to happen is that every "connect" event is followed by a "change" event. Then the connection drops (ui-control node emits a "lost" payload) immediately followed by another "connect" and "change", essentially triggering the flow twice. See debug output below:

Is this expected behavior (connect followed by change)? Also, what would cause the "lost" connection and how do I troubleshoot this? Thanks for your help

[{"id":"f13e35c22de01c0f","type":"inject","z":"3c0c33a32557141e","name":"Manual Startup","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":222.33334350585938,"y":191.00000953674316,"wires":[["c4fe837b4b2c93bf"]]},{"id":"c4fe837b4b2c93bf","type":"ui-control","z":"3c0c33a32557141e","name":"Startup","ui":"de5759a313e7ad79","events":"connect","x":412.64703369140625,"y":190.86947631835938,"wires":[["0044f01175b23393","8c5731ed8d47e18d"]]},{"id":"8c5731ed8d47e18d","type":"debug","z":"3c0c33a32557141e","name":"Connect","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":558.06982421875,"y":120.82720947265625,"wires":[]},{"id":"392b9dff111841c1","type":"ui-control","z":"3c0c33a32557141e","name":"Refresh Tab","ui":"de5759a313e7ad79","events":"change","x":1136.6471252441406,"y":60.873138427734375,"wires":[["6dd64b6ebf6cdee9"]]},{"id":"6dd64b6ebf6cdee9","type":"debug","z":"3c0c33a32557141e","name":"Refresh","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1314.1875,"y":47.82720947265625,"wires":[]},{"id":"de5759a313e7ad79","type":"ui-base","name":"Node-RED Dashboard","path":"/dashboard","appIcon":"","includeClientData":false,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"dashboard","navigationStyle":"fixed","titleBarStyle":"default","showReconnectNotification":true,"notificationDisplayTime":5,"showDisconnectNotification":true,"allowInstall":true}]

EDIT: Node-RED v 4.0.9
MacOS:15.5
Node.js: 22.15.0

I would expect to see the Connect followed by a Change, as the client has connected and then opened that tab. I would not expect to see the disconnect, and I don't see that when I run your flow on my system.

What version of @flowfuse/node-red-dashboard are you running. If it is not the latest (1.25.0) then update that, restart node-red and try again.

If you are already running the latest, when it reconnects is it connecting with a different socketID in the _client object?

If you look in the node-red log do you see the two connects?

What are you doing to cause the initial connection?

1 Like

Hold on, there is stuff missing from your debug output. It should look like this

1 Like

@Colin - I am running 1.25.0 of @flowfuse/node-red-dashboard

That is strange - I don't see the "client" object in my debug. Is DB2 multi-tenancy on by default or is it something that has to be enabled? I imported my old flows but on a fresh install of Node-RED (running it standalone on my local laptop), so maybe that has something to do with it?

OK - that makes sense, I think I can adjust my flows to be triggered by the "change" message.

I can't get it to happen now either. There is some weird scenario where one of my flows is going into a loop so maybe that was causing it. Still trying to figure out was is going on.:thinking:

I beleive there is a setting in the dashboard node or sidebar to turn on/off client data Building Multi-Tenant Dashboards | Node-RED Dashboard 2.0

1 Like

I got the disconnect (but no "connect") in the logs. I took out the debug node, so don't know if there was something else there.

The strange thing is that this seems to happen when I am loading data into a ui-tabulator table. However a different page with an almost identical flow (also populating a ui-tabulator table) seems to work just fine.

EDIT: I did have the debug node but I was filtering on "current flow" so did not see it. I see multiple "lost" and "connect" events in the debug panel :frowning:

I would have expected Transport Error to mean there is some sort of networking issue causing the connection to be dropped and restored, but maybe that error can occur for other reasons.

Run top or other system monitor on the server and see if the CPU is being maxed out temporarily.

1 Like

I’m running it local on my laptop. The problem seems to be with that one page. If I change pages and go to another one, it does seem to work. I’m going to let it be overnight and look at it again tomorrow. Hopefully, it will be something simple. Thanks again for all your help.

In the example you posted you are not actually doing anything when the page is switched. In your real flow are you taking action when that page is selected? It may be that which is triggering the connection dropout. Try disconnecting the ui-control nodes from the action and see if that stops the dropout.

1 Like

Actually that is one of the problems that I'm having. The ui-control node is on a separate flow and on tab change, it is supposed to trigger a particular flow, depending on the tab name (determined in a switch node which is connected to a link-out node). The problem is that the link-in node never gets triggered.

So far, I have manually been triggering the flow with an inject node.

Is the switch node sending anything?

1 Like

Aargh - I feel really stupid now :pensive_face:. I thought I had tried a debug after the switch node. Turns out I had an extra space in my tab name! And that appears to have fixed the disconnect issue (not sure why but will test some more). Thanks so much for your help.

@Colin - I wonder if the disconnects were related to this? https://discourse.nodered.org/t/node-red-dashboard-2-table-tabulator-problems-when-loading-data/98225/2

Only if you are sending massive amounts of data across.