• Communication protocol
  • Persistent, bidirectional channel over a single TCP connection
  • Unlike HTTP, which requires a new request for every interaction, WebSockets allow both clients and servers to push data instantly
  • Eliminates network overhead and dramatically reduces latency for real-time applications
  • Handshake
    • WebSocket connection begins with an HTTP/HTTPS request
    • Client sends an Upgrade: websocket header
    • Server responds with a 101 Switching Protocols status code to confirm upgrade
  • Persistent Connection
    • Once established connection remains open until either the client or server actively closes it
  • Bi-directional (full-duplex)
    • Both the client and server can independently send messages or text/binary data at any time without waiting for a request or response