Real Time Updates easy
How does 'Long Polling' differ from standard 'Short Polling'?
- A It uses a longer URL.
- B The client waits 1 hour between requests.
- C The server holds the request open until new data is available (or a timeout occurs), rather than returning an empty response immediately.
- D It requires a special browser plugin.
Answer: C. The server holds the request open until new data is available (or a timeout occurs), rather than returning an empty response immediately.
Long Polling reduces the 'empty checks'. The client asks, and the server says 'Wait...'. When data arrives 10 seconds later, the server answers. The client processes it and immediately asks again.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- When a mobile app is closed/backgrounded, it cannot keep a WebSocket open. How does it receive real-time alerts (like 'New Message')?
- For a human user, what is generally considered the maximum acceptable latency for an interaction to feel 'Real-Time' (e.g., typing in a Google Doc)?
- If you want to update a news feed on a website every time a new article is published, what is the simplest (but least efficient) 'Real-Time' technique?
- In a persistent real-time connection, what is the purpose of a 'Heartbeat' or 'Ping/Pong' message?
- Why is Short Polling considered 'Chatty'?
- Server-Sent Events (SSE) are ideal for which type of real-time application?