The live org-chart in the Harnyss dashboard looks simple: a few nodes, some animated edges, status dots blinking as agents work. Under the hood, it's a distributed real-time graph synchronization problem that took us three rewrites to get right.
Why we dropped WebSockets
Our first implementation used a WebSocket connection per dashboard session. Every agent state change was broadcast to all connected clients. This worked fine at 10 concurrent users. At 200, our gateway was spending 40% of its CPU budget managing ping/pong heartbeats and connection state.
We switched to Server-Sent Events. SSE is unidirectional — server pushes, client receives — which eliminates the heartbeat overhead and lets us use standard HTTP/2 multiplexing. Reconnection is handled natively by the browser. We lost the ability to push from client to server, but we didn't actually need it: all mutations go through our REST API.
// SSE event structure
{ "type": "agent.state_changed",
"agentId": "coo-01",
"prev": "idle",
"next": "working",
"task": "ops_review",
"ts": 1745923847291 }Delta diffing the graph
Rather than sending full graph snapshots on each change, we maintain a versioned graph on the server and send only the delta — which nodes changed, which edges were added or removed. Clients apply patches to their local copy using a simple operational transform.
End-to-end latency from agent state mutation to pixel update in the dashboard: p50 = 18ms, p99 = 38ms, measured across our production fleet.