Real-time systems

Real-time products built around truth, not just speed.

Real-time is a product promise: after a user acts, every participant should converge on trustworthy state quickly enough to make the next decision. WebSockets are only one transport inside that larger reliability problem.

A stream is notification, durable state is truth

Clients disconnect, messages are delayed, and processes restart. Use sequence numbers, resumable cursors, and snapshot-plus-stream recovery so a reconnecting client can prove what it missed and rebuild current state.

  • Monotonic sequence or entity version
  • Snapshot followed by ordered events
  • Backoff with jitter for reconnects
  • Bounded buffers for slow consumers

Design latency budgets end to end

Break the user-visible budget across client work, network, API, database, queue, fan-out, and rendering. Measure p50, p95, and p99 at the workflow boundary; service averages hide exactly the tail failures users remember.

Retries require idempotency

At-least-once delivery is common and useful, but only when duplicate commands cannot duplicate side effects. Store idempotency keys, make transitions conditional, and retain an audit trail that explains every accepted or rejected event.