Real Time Updates easy
In a persistent real-time connection, what is the purpose of a 'Heartbeat' or 'Ping/Pong' message?
- A To measure the internet speed.
- B To detect if the connection is dead (e.g., user unplugged cable) so the server can clean up resources.
- C To synchronize the system clock.
- D To encrypt the channel.
Answer: B. To detect if the connection is dead (e.g., user unplugged cable) so the server can clean up resources.
TCP connections can silently die (Ghost Connections) without sending a proper 'Disconnect' signal. Periodic pings ensure both sides know the other is still alive.
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?
- Why is Short Polling considered 'Chatty'?
- Server-Sent Events (SSE) are ideal for which type of real-time application?
- What is the primary advantage of using a WebSocket over standard HTTP for a chat application?