Open r002 opened 4 years ago
Here, I just clicked on the "Request heartbeat..." link and Connections No 3 & 4 updated their "Last Heartbeat" timestamps. Conn No 1 & 2 didn't update though because those clients have been closed (either due to connectivity loss of the Chrome tab was force-closed, etc).
clientMap.size() > 0
that evicts stale connections. Update the status
field for each client in the server's clientMap
. Do the "stale" vs "fresh" ms delta calculation on the server.Not a bug: clientMap on the Admin GUI is 10 seconds behind the ts that's being broadcast to all client endpoints. Investigate and fix.
clientMap should only be broadcasted to all endpoints in the following cases:
Problem
SSE doesn't automatically detect if a client has died. This means over time our
clientMap
will be polluted with zombie clients. Cycling the server will request an auto-reconnect (supported by SSE out of the box) but we need another way to prune dead clients fromclientMap
.Solution
Add a REST endpoint that, when hit, requests a heartbeat from all connected clients that are still alive. Any client that doesn't pong back within X seconds will then be removed from
clientMap
. [Should this REST endpoint be a GET or POST?]Tasks:
clientMap
into a beautiful table.Prune zombie clients!
button & function to the admin GUI.