January 8, 2025 • 16 min read
Three ways to keep a React UI in sync with the server. I've shipped all three, and the thing I keep running into is teams reaching for WebSockets because real-time sounds better, then spending a sprint on reconnect logic for a dashboard that updates every ten seconds. Polling would have been a fetch in a setInterval. Here's how I pick.
My rule of thumb: start with polling. If the lag genuinely hurts the feature and you've measured it, move that one feature to a socket. Forms stay on Server Actions. I've never regretted starting with the boring option, and I have regretted the other way round, when the socket layer became the thing that paged me at the weekend.