Real Time Updates easy
How does a WebSocket connection start?
- A It uses a special port (8080).
- B It starts as a normal HTTP request with an `Upgrade: websocket` header.
- C It sends a UDP packet first.
- D It requires the user to install Java.
Answer: B. It starts as a normal HTTP request with an `Upgrade: websocket` header.
To bypass firewalls (which often block non-web traffic), WebSockets start as standard HTTP traffic (Port 80/443). Once the server agrees to the 'Upgrade', they switch protocols on the same connection.
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?