Recall & Review
beginner
What is a WebSocket?
A WebSocket is a communication protocol that provides a full-duplex, persistent connection between a client and a server, allowing real-time data exchange.
Click to reveal answer
beginner
How does WebSocket differ from HTTP?
Unlike HTTP, which is request-response and stateless, WebSocket creates a continuous connection allowing both client and server to send data anytime without repeated handshakes.
Click to reveal answer
beginner
What is the main advantage of using WebSockets for real-time communication?
WebSockets reduce latency and overhead by keeping the connection open, enabling instant data transfer which is ideal for chat apps, live updates, and games.
Click to reveal answer
intermediate
What does 'full-duplex' mean in the context of WebSockets?
Full-duplex means data can be sent and received simultaneously between client and server over the same connection.
Click to reveal answer
intermediate
What is the initial step to establish a WebSocket connection?
The client sends a WebSocket handshake request to the server over HTTP, which the server upgrades to a WebSocket connection if accepted.
Click to reveal answer
Which protocol does WebSocket start with before upgrading the connection?
✗ Incorrect
WebSocket connections begin with an HTTP handshake request that upgrades the connection to WebSocket.
What type of communication does WebSocket provide?
✗ Incorrect
WebSocket supports full-duplex communication, allowing simultaneous two-way data flow.
Which of these is a common use case for WebSockets?
✗ Incorrect
Live chat apps need real-time updates, which WebSockets provide efficiently.
What happens if a WebSocket connection is closed?
✗ Incorrect
Once closed, the WebSocket connection must be reopened to resume communication.
Which layer of the internet protocol stack does WebSocket operate on?
✗ Incorrect
WebSocket is an application layer protocol built on top of TCP.
Explain how WebSockets enable real-time communication between a client and a server.
Think about how WebSocket keeps the connection open and allows both sides to send data anytime.
You got /4 concepts.
Describe a real-life example where WebSockets improve user experience compared to traditional HTTP.
Consider apps like messaging or live sports scores.
You got /4 concepts.