Is there a problem with the way re-connection is handled with D2?

I think there may be a fundamental problem with the way D2 handles socket disconnection/reconnection.

For example, if there is a chart on the dashboard and the connection drops for a short time (or a long time) then this is sort of thing is seen on the dashboard

image

A page refresh restores the missing data.

For, I suspect, the same reason, if there is a text node and, while the network is down, text is sent to it, then when the network recovers the old text is still shown, with no indication that the dashboard is out of phase with reality. This could be serious if, for example, the dashboard was showing an alarm status display. After a brief network interruption the display may not show important alarms that triggered during the outage.

In the same situation with D1, when the connection is restored the whole display flashes, which I suspect means the the page is being reloaded.

I think there may be a good argument for saying that, with D2, on a reconnect, the page should be reloaded. This would have the side effect of also fixing the problems with ui_templates not functioning correctly after a reconnection.

Hi Colin, I concur. I also face such problems, even after the latest D2 upgrade which solves some of the issues.

In my D2 custom table node, I noticed that when the server node is created (e.g. upon Node-red restart, deploy etc.), some of its custom event handlers may stop working. As a temporary workaround, once created my node sends a special command to the clients, telling them to reload themselves. This solves the problem (albeit with a flicker).

Note that regardless of the reconnect issues, a dashboard node should be designed to be able to restore itself upon load, so that when opening a new client (browser instance), it will sync and show the same data as in other clients.