Recall & Review
beginner
What is the WebSocket protocol?
WebSocket is a communication protocol that allows a two-way, full-duplex connection between a client and a server over a single, long-lived TCP connection.
Click to reveal answer
beginner
How does WebSocket differ from HTTP?
Unlike HTTP, which is request-response and short-lived, WebSocket keeps the connection open, allowing real-time, continuous data exchange without repeated handshakes.
Click to reveal answer
intermediate
What is the initial step to establish a WebSocket connection?
The client sends an HTTP upgrade request to the server asking to switch the protocol from HTTP to WebSocket, called the handshake.
Click to reveal answer
beginner
What does 'full-duplex' mean in WebSocket communication?
Full-duplex means both client and server can send and receive messages independently at the same time without waiting for the other side.
Click to reveal answer
beginner
Why is WebSocket useful for real-time applications?
Because it keeps the connection open and allows instant two-way data flow, WebSocket is great for chat apps, live updates, games, and other apps needing fast interaction.
Click to reveal answer
What protocol does WebSocket start with before switching?
✗ Incorrect
WebSocket begins with an HTTP handshake to upgrade the connection to WebSocket.
Which feature best describes WebSocket communication?
✗ Incorrect
WebSocket supports full-duplex communication, meaning both sides can send data simultaneously.
What happens after the WebSocket handshake is successful?
✗ Incorrect
After handshake, a persistent, open connection allows continuous data exchange.
Which is NOT a typical use case for WebSocket?
✗ Incorrect
Static websites do not require real-time two-way communication, so WebSocket is unnecessary.
What does the WebSocket protocol use to keep the connection alive?
✗ Incorrect
WebSocket uses a single TCP connection kept open for continuous communication.
Explain how a WebSocket connection is established and why it is different from a normal HTTP connection.
Think about the initial request and what changes after the handshake.
You got /4 concepts.
Describe real-life scenarios where WebSocket is a better choice than HTTP and why.
Consider apps that need instant updates without refreshing.
You got /4 concepts.