What is WebSocket?
A protocol providing a persistent, full-duplex connection between client and server, enabling real-time bidirectional communication over a single TCP socket.
Definition
WebSocket (RFC 6455) upgrades an ordinary HTTP request into a long-lived, full-duplex TCP connection, letting server and client push messages to each other at any time without the overhead of repeated HTTP requests. It powers chat, live dashboards, multiplayer games, and collaborative editors. The handshake starts with an HTTP Upgrade header, then switches to lightweight binary frames over ws:// or encrypted wss://. Libraries like Socket.IO add reconnection and fallbacks on top. For one-way server push, Server-Sent Events is a simpler alternative; WebSocket wins when traffic flows both directions.

