node-red-dashboard icon indicating copy to clipboard operation
node-red-dashboard copied to clipboard

Dashboard does not reconnect if network is down for a significant time.

Open colinl opened this issue 1 year ago • 1 comments

Current Behavior

I find that if, on a PC, I open the dashboard and disconnect the network and leave it for 30 mins (not sure what the min time to show the problem is) then it never reconnects when I connect the network again, it just sits there with Connection Lost popup. I see the same on Android sometimes when I re-open the dashboard window after it has been in the background for some time. I suspect it is the same issue.

Expected Behavior

Not sure. In the same circumstance the editor shows a Reconnecting in nn seconds and a Try Now link. I think it tries every 30 secs or maybe 60.

I think that in the same circumstance, D1 reconnects automatically, and quickly, as I don't see an issue there in the same circumstances (on Android at least). I am going to try some tests on the PC with D1 to check how it performs.

In the same circumstance the editor shows a 'Reconnecting in nn seconds' popup with a Try Now link. I think it tries every 30 secs or maybe 60, but it would be a pain if every time I open the dashboard on the phone I have to click something to get it to reconnect.

Steps To Reproduce

Open the dashboard and disconnect the network. Leave for 30 mins and then reconnect.

Environment

  • Dashboard version: 1.8.1
  • Node-RED version: 4.0.0 Beta 2
  • Node.js version:
  • npm version:
  • Platform/OS: Browser on Ubuntu laptop, server on Pi
  • Browser: Edge

Have you provided an initial effort estimate for this issue?

I am not a FlowFuse team member

colinl avatar Apr 27 '24 16:04 colinl

In the case where I suspend the laptop and then start it again some time later then again I get the connection lost message and it does not reconnect. Perhaps what is happening here is that node red gets going again before the network is up so starts the reconnection sequence, but since it is a long time since the last good connection it immediately hits the timeout and so does not try again. If that fits the way the code works then perhaps the algorithm should work based on the number of retry attempts rather than a timeout, so in the case of suspend (or Android pausing it when it is running in the background) it would keep trying to connect for some time after the device is woken up.

colinl avatar Apr 28 '24 10:04 colinl

Fixed by PR #950

colinl avatar Jun 12 '24 08:06 colinl