0
0
Node.jsframework~5 mins

WebSocket protocol concept in Node.js - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AFTP
BTCP
CSMTP
DHTTP
Which feature best describes WebSocket communication?
ARequest-response only
BFull-duplex
COne-way streaming
DStateless
What happens after the WebSocket handshake is successful?
AA persistent connection is established
BClient sends HTTP requests repeatedly
CConnection closes immediately
DServer sends a file download
Which is NOT a typical use case for WebSocket?
AStatic website hosting
BReal-time gaming
CLive chat applications
DStock price updates
What does the WebSocket protocol use to keep the connection alive?
ARepeated HTTP requests
BMultiple UDP packets
CA single TCP connection
DEmail notifications
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.