Skip to content

Dashboard: show a lost connection at once, and reconnect when the server is back - #306

Merged
msx752 merged 2 commits into
developfrom
fix/dashboard-connection-state
Nov 26, 2026
Merged

msx752 merged 2 commits into
developfrom
fix/dashboard-connection-state

Conversation

@msx752

@msx752 msx752 commented Nov 26, 2026

Copy link
Copy Markdown
Owner

The connection store registered its handlers for the connection's own events (reconnecting, reconnected, closed) only in a start-up path that nothing calls. When the server went away, the socket closed within a second, but the header showed "WebSocket Disconnected" only at the next health check (22 s in a test) and kept "Online", which is read once when the page loads.

Change

  • The handlers are registered on the live connection, once per connection object.
  • A close the page did not cause starts a reconnection. A connection whose own automatic reconnect gave up closes without an error, so the error alone did not start one; closes the page makes itself (forced reconnection, new token, cleanup) are excluded.
  • A second start waits for the start in flight and gets its result, instead of returning at once while the connection is still Connecting (which made a failed start look like a success and could stop the reconnection loop).
  • The scheduler status is read again when the connection is lost or comes back, so the header shows "Offline" while the server is gone. A failed read shows the usual network error toast once per outage.

What does not change

  • The server, the hub messages, the Reconnect button, pages' own data loading.

Testing

  • In a browser (sample app), server stopped under an open page:
    • before: socket closed after 0.8 s, header "WebSocket Connected / Online" until 22 s, then "Disconnected / Online";
    • after: "WebSocket Connecting / Offline" within 1 s, then "Disconnected / Offline".
  • Server stopped for 12 s and started again: the page is back to "WebSocket Connected / Online" 3 s after the restart, and a time ticker added then reaches the page as a live update. (On develop the header never left "Connected" during the outage, so a recovery could not be seen there.)
  • The dashboard suite passes, vue-tsc --build clean, no new lint messages. This PR changes no .NET file; every .NET test project passed on the same develop base.
  • An independent review of the diff; its findings (the early return while Connecting, the status read before the layout's services exist) are fixed in the second commit.

…ver is back

The connection store registered its handlers for the connection's own
events (reconnecting, reconnected, closed) only in a start-up path that
nothing calls. A dropped connection therefore showed only at the next
health check, up to 30 seconds later, and the header kept "Online", read
once when the page loaded.

- The handlers are registered on the live connection, once per
  connection object.
- A close the page did not cause starts a reconnection: a connection
  whose own automatic reconnect gave up closes without an error, so the
  error alone did not start one.
- The scheduler status is read again when the connection is lost or
  comes back, so the header shows "Offline" while the server is gone.
startConnectionAsync returned at once while the connection was still
Connecting, so a caller took a start that later failed for a success and
the reconnection loop could stop. A second caller now waits for the start
in flight and gets its result. The header status read skips while the
layout has not loaded its services yet.
@msx752
msx752 merged commit 653179a into develop Nov 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant