Telling clients there is new content
A feed that only updates on manual refresh feels dead. Users expect a new posts banner to appear while they watch. The system needs a way to push fresh content to clients in near real time.
Polling versus pushing
- Polling has the client ask repeatedly, any new posts now. It is simple but wasteful, most checks return nothing, and updates lag the poll interval.
- Pushing keeps a long lived connection, a websocket or server sent stream, so the server tells the client the moment something arrives.
Pushing scales better for feeds because content is bursty and clients are many.
How the push path works
- When a post is fanned out to a user feed, an event is also sent to that user live connection if one is open.
- A fan out service publishes update events to the connection layer, which routes them to the right open sockets.
- The client receives a lightweight signal and shows a banner, then fetches the new items when the user taps.
Handling scale and gaps
Connections are stateful and numerous, so a dedicated tier manages them. If a client disconnects, it reconnects and reconciles using its last cursor to catch up on missed content.
Key idea
Real time feeds push update events over long lived connections through a connection tier, so clients learn of new posts instantly and reconcile by cursor after reconnecting.