Compare WebSocket, SSE, and long polling
Company: Snapchat
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: hard
Interview Round: Onsite
In the context of building real-time features for a web application, answer the following networking fundamentals questions:
1) **WebSocket vs. Server-Sent Events (SSE):** Compare them in terms of communication direction (uni/bidirectional), transport/protocol, browser/client support, reconnection behavior, scalability/load balancers, and typical use cases.
2) **OSI model:** Briefly describe the purpose of each OSI layer and give common examples of protocols/technologies that map to each layer. Also explain how the OSI model relates to the practical TCP/IP model.
3) **TCP vs. QUIC:** Compare TCP and QUIC in terms of where they run (kernel/user space), handshake latency, TLS integration, multiplexing and head-of-line blocking, connection migration, and when QUIC is typically preferred (e.g., HTTP/3).
Quick Answer: This question evaluates understanding of real-time web communication protocols, OSI and TCP/IP networking models, and transport-layer trade-offs among WebSocket, Server-Sent Events, TCP and QUIC.