Recall & Review
beginner
What is long polling in web communication?
Long polling is a technique where the client sends a request to the server and waits for the server to respond only when new data is available, keeping the connection open for a longer time instead of immediately responding.
Click to reveal answer
intermediate
How do Server-Sent Events (SSE) differ from long polling?
Server-Sent Events allow the server to push updates to the client over a single, long-lived HTTP connection without the client repeatedly requesting data, unlike long polling where the client must send new requests after each response.
Click to reveal answer
intermediate
Name one advantage of using Server-Sent Events over WebSockets.
Server-Sent Events are simpler to implement for unidirectional data flow from server to client and work over standard HTTP, making them easier to use with existing infrastructure and proxies.
Click to reveal answer
beginner
What happens if the server has no new data during a long polling request?
The server holds the request open until new data is available or a timeout occurs, then responds to the client. The client then immediately sends a new request to continue waiting for updates.
Click to reveal answer
advanced
Why might long polling cause more server load compared to Server-Sent Events?
Because long polling requires the client to repeatedly open new HTTP connections after each response, it can create more overhead and resource usage on the server compared to a single persistent connection used by Server-Sent Events.
Click to reveal answer
Which technique keeps a single HTTP connection open for continuous data flow from server to client?
✗ Incorrect
Server-Sent Events use a single long-lived HTTP connection to push data continuously from server to client.
In long polling, what does the client do after receiving a response from the server?
✗ Incorrect
After receiving data, the client closes the connection and immediately sends a new request to wait for more data.
Which of the following is a limitation of Server-Sent Events?
✗ Incorrect
SSE supports only server-to-client data flow, not client-to-server messages.
Why might long polling be less efficient than Server-Sent Events?
✗ Incorrect
Long polling repeatedly opens and closes HTTP connections, causing more overhead than SSE's single persistent connection.
Which scenario is best suited for Server-Sent Events?
✗ Incorrect
SSE is ideal for pushing live updates from server to clients in one direction.
Explain how long polling works and describe its request-response cycle.
Think about how the client waits for data and how the server responds.
You got /4 concepts.
Compare Server-Sent Events and long polling in terms of connection management and data flow.
Focus on how connections are kept open and how data is sent.
You got /4 concepts.