What is WebSocket?
A communication protocol that enables full-duplex, real-time data exchange between a browser and server over a single connection.
WebSockets provide persistent, bidirectional communication between client and server. Unlike HTTP (request-response), WebSockets allow the server to push data to clients instantly without polling.
Use cases include chat applications, live dashboards, gaming, collaborative editing, and real-time notifications. The connection starts as an HTTP upgrade request, then switches to the WebSocket protocol (ws:// or wss://).