How sparQ handles real-time team status
Real-time team status is the feature with the most surface area in the product. Every teammate, every change of state, every focus toggle pushes through here.
We chose server-sent events over WebSockets early. SSE is one-way (server to client), which is what we need for presence. The added simplicity of a single HTTP long-poll, with automatic reconnection in the browser, has saved us repeatedly.
Presence state lives in Redis. Each connected client maintains a TTL'd key. A heartbeat refreshes the key every fifteen seconds. A missed heartbeat after thirty seconds drops the user to "away."
The trade-offs we made: we don't replay missed events. If a client disconnects for two minutes and reconnects, they get the current state, not the history. This is fine for presence and bad for chat, which is why chat lives elsewhere.