When you plan an app, "real-time" sounds like the obvious choice. Nobody wants to look at old data. But real-time is the most expensive way to show new data, to build and to keep running, and on most screens of a business app nobody can tell the difference.
A screen can get fresh data in three ways. I choose per feature, not per app.
Three ways a screen stays fresh
- Polling. The screen asks the server "anything new?" on a timer, for example every 30 seconds.
- Adaptive polling. The same, but the timer speeds up while someone is looking and slows down or stops when nobody is.
- Real-time. A connection stays open, and the server sends news the moment it happens.
Most screens can wait 30 seconds
One request every 30 seconds costs the server almost nothing. For an order status, a dashboard, a notification dot or an inbox of new inquiries, a person can't tell it from live.
So I go screen by screen. Chat needs real-time, because two people are waiting on each other. An order list checks every 30 seconds. A monthly report loads when you open it, and that's it.
When real-time is worth paying for
- People wait on each other: chat, or two people editing the same thing.
- The server has news nobody asked for: a notification inside the app the moment something happens.
- Polling would have to ask every couple of seconds from hundreds of screens. Then the traffic costs about as much as real-time, and it feels worse.
Watch out: "we might need it later" is not one of the reasons. Build real-time when the feature that needs it exists, not before.
Real-time breaks in harder ways
When a polling screen stops updating, one look at one request shows the bug.
Real-time bugs hide: in reconnecting after a phone loses signal, in logins that expire while the connection is still open, in servers that cut connections that have been quiet too long, in screens that show stale data after a reconnect. Each of these can take days to track down, often after it broke at 2 a.m.
The middle way: adaptive polling
For most screens that "should feel live", like an order status, a support inbox or the numbers on a dashboard, the answer isn't real-time. It's polling with a smart timer:
- every 5 seconds while the screen is open and in front,
- every 60 seconds while it is in the background,
- not at all once it has been hidden for more than 5 minutes.
That's 6 to 12 lines of code, and it covers most "we need live updates" requests.
Fix: I ship the polling version first. I move a feature to real-time only when measurements show polling misses the target, on speed or on cost. Not because it sounded good in a meeting.
For your developer
- Adaptive interval: 5 s focused, 60 s in the background, stop after 5 minutes of
visibilityState === "hidden", resume onvisibilitychange. - One-way updates at low frequency: Server-Sent Events. Plain HTTP, simpler than WebSockets, and it gets through most proxies.
- WebSockets (I use Socket.IO) only when data flows both ways or has to arrive in under a second. Plan for reconnects, token expiry on open sockets, proxy idle timeouts, sticky sessions with more than one server, and a refetch of state after every reconnect.
Not sure which of your screens need what? Bring the list to a free 30-minute call.