Home › Learn › Real-time analytics › Push to the screen

Real-time analytics · page 9 of 11

Push to the screen: snapshot first, then small changes

Push semantics for real-time dashboards: snapshot then changes, SSE vs WebSocket, where changes come from when the store cannot push, and gateways per cloud.

↑ All of real-time analyticsReal time, explainedLambda vs KappaComponents, left to rightChange capture toolsWhich route?Eight designsDesigns on each cloudContracts and bindingsPush to the screenWhat it costsEstablished technologies

In plain words

Do not make the screen ask

With pull, the screen asks every few seconds: "anything new?". With push, the server tells the screen when something changes. Push gives fresher screens with less load, but only if the server sends small changes, not every raw event.

Results topicor streaming DBsubscriptionPush gatewaykeeps who seeswhat1. snapshot on connect2. small changesBrowserthrottle: at most one update a second per widget; never forward raw events
Snapshot first, then small, throttled changes.

The pattern

Snapshot, then changes

  1. When the screen connects, send a snapshot: the current numbers.
  2. Then send only changes, throttled to about one per second per widget.
  3. On reconnect, send a fresh snapshot, so a dropped connection never leaves a wrong number on screen.
  4. Never forward raw events to the browser; the server works out what changed.

The channel

SSE or WebSocket?

ChannelWhat it isUse it whenVerdict
Server-Sent Events (SSE)One-way updates from server to browser over plain HTTP; reconnects by itselfDashboards and live boardsPursue as the default
WebSocketA two-way connectionThe user also sends things back: filters that change the live query, collaborationPursue when you need two-way
GraphQL subscriptionsPush through a GraphQL APIYou already serve GraphQLFine with a reason
Long-pollingThe browser holds a request open until there is newsOnly very old browsers or proxiesDrop

Where changes come from

Most analytics stores do not push

GatewayAzureAWSOpen source and services
Push serviceAzure SignalR, Azure Web PubSubAPI Gateway WebSocket APIs, AppSync subscriptionsSocket.IO, a small Node or Go SSE service; Ably, Pusher

BI tools such as Power BI do not push; their best is automatic page refresh. See which route for where they fit.

FAQ

Questions people ask

SSE or WebSocket for a real-time dashboard?

SSE for most dashboards: updates only flow one way, it runs over plain HTTP and reconnects by itself. Use WebSocket when the user also sends data back, such as filters that change a live query.

Does ClickHouse push changes to the browser?

No. Either a stream processor writes changes to a results topic that a gateway reads, or the gateway polls ClickHouse every second and pushes only the difference.

How often should a dashboard update?

About once a second per widget is plenty for people. Faster updates cost more and nobody can read them.

Next

Where to go next

Next page: What real-time analytics costs

↑ All of real-time analytics · Data platform architecture · Key concepts