21. Polling vs WebSockets vs Push
Interview questions
Interview questions (with the counter-questions you'll get)
Q1. Compare short polling, long polling, SSE and WebSockets.
They're testing: the core comparison.
Think about your answer first, then open it.
Q2. How do you scale WebSockets to millions of users?
They're testing: stateful connection design.
Think about your answer first, then open it.
Q3. How do you make sure a client doesn't miss messages after reconnecting?
They're testing: reliability on unreliable networks.
Think about your answer first, then open it.
Q4. What are heartbeats for?
They're testing: operational detail.
Think about your answer first, then open it.
Q5. What's a thundering herd on reconnect, and how do you prevent it?
They're testing: failure thinking.
Think about your answer first, then open it.
Q6. How do push notifications work?
They're testing: mobile realities.
Think about your answer first, then open it.
Q7. Design the "typing..." indicator in a chat app.
They're testing: applying WebSockets sensibly.
Think about your answer first, then open it.
Q8. Why might you choose SSE over WebSockets?
They're testing: judgement, not fashion.
Think about your answer first, then open it.
Q9. How do you authenticate a WebSocket connection?
They're testing: security on stateful connections.
Think about your answer first, then open it.
Q10. How would you deploy new code to WebSocket servers without disconnecting all users at once?
They're testing: operating stateful services.
Think about your answer first, then open it.