The problem
Real-time interfaces are usually built on the happy path: a fast connection, a server that answers, data that arrives in order. Real users are on trains, on hotel Wi-Fi and on phones that suspend tabs. When the connection drops, many interfaces keep showing the last value as if it were current. A user acts on a number that stopped updating a minute ago.
Actions have the same problem. A user submits an order or a change, and the interface either freezes or shows success before the server has confirmed it. When the request fails, there is no clear state to recover from, and the user tries again and creates a duplicate.
Performance degrades quietly too. High-frequency updates re-render large parts of the page. Interactions start to lag, and Interaction to Next Paint (INP) climbs on mid-range devices.
What we put in the spec
We spec what the interface knows and how sure it is. Every piece of live data has a freshness rule, and every action has a full set of states. The feature spec template has a section for exactly this.
Latency and freshness budgets
For each data stream the spec states:
- Expected update interval: how often new data should arrive.
- Stale threshold: how old data can be before the interface must say so.
- Latency budget: the longest acceptable time from a server event to the screen, on a named reference device and network.
Staleness and connection states
| State | What the user sees |
|---|---|
| Live | Data as normal |
| Stale | The value plus a clear “last updated” time, and any risky actions paused |
| Reconnecting | A non-blocking notice. Data shown as stale |
| Offline | Actions that need the server are disabled with a reason |
| Recovered | Data refreshed. A brief notice if values changed while away |
Reconnect behaviour
The spec defines the retry strategy (for example, exponential backoff with a ceiling), what is re-fetched after reconnecting, how missed events are reconciled, and how duplicate submissions are prevented.
Pending and failed actions
Each action has idle, pending, confirmed, failed and retried states. Optimistic updates are allowed only where the spec says a rollback is safe.
Feature: Stale data is never shown as live
Scenario: The live connection drops
Given a user viewing a live value
When no update arrives within the stale threshold
Then the value shows the time it was last updated
And actions that depend on the value are paused with a reason
And the interface returns to "live" within one update after reconnecting
How it is checked before release
Real-time behaviour can only be trusted when it has been tested under the conditions that break it.
- Network condition tests: end-to-end tests run with throttled, lossy and dropped connections, and with the tab suspended and resumed.
- Deterministic event mocks: a mock stream sends events late, out of order, duplicated and missing, and the tests check every state in the table.
- Performance budgets: INP is measured during high-frequency updates on a named mid-range device profile, and the build fails if it exceeds the budget in the constitution.
- Accessibility: live regions announce meaningful changes without flooding screen readers, and state changes keep focus where the user left it.
Every change passes the quality gates and a senior review.
What changes for you
Users can trust what they see, because the interface says when it doesn’t know. Support stops hearing “the number was wrong”, because stale data is labelled. Duplicate actions drop, because every action has a pending and confirmed state with a guard against resubmission.
Your team also gets a shared definition of “real-time” that design, backend and frontend can all test against.
What you receive
| Deliverable | Format |
|---|---|
| Freshness and latency budget per stream | In the spec |
| Connection state model with copy | Diagram plus table |
| Action state model per action | In each feature spec |
| Reconnect and reconciliation rules | In the plan |
| Network and event mock test suite | In your CI |
| INP measurements under load | In each trace report |
Common failure patterns
These are the patterns that cause most real-time incidents in the interface. Each one maps to a state or a rule above, and each has a test.
| Pattern | What users experience | What the spec requires |
|---|---|---|
| Last value shown as current after a drop | Decisions made on old data | A stale state with “last updated” |
| Success shown before confirmation | Lost or duplicated actions | Pending and confirmed states, idempotent submits |
| Full re-render on every event | Lag, high INP | Updates scoped to the changed values, measured |
| Silent reconnect loops | Battery drain, no feedback | Backoff with a ceiling and a visible state |
What we need from you
We need the event contract from your backend, including ordering and replay guarantees, the actions that carry real risk if they run on stale data, and a reference device you care about. Your backend stays yours. We build the frontend that reads it, starting with a Spec Sprint.