What is WebSocket?

  • WebSocket is a computer communications protocol
  • WebSocket is a bidirectional, a full-duplex protocol over a single TCP connection (HTTP is uni-directional)
  • WebSocket is is used in client-server communication
  • The WebSocket protocol enables two-way real-time communication between clients and servers in web-based applications
  • WebSocket protocol was standardized by the IETF as RFC 6455 in 2011, and the WebSocket API (in Web IDL) is being standardized by the W3C (Web IDL is an interface description language format for describing application programming interfaces that are intended to be implemented in web browsers)

The WebSocket protocol enables message exchange between clients and servers on top of a persistent TCP connection (optionally secured with Transport Layer Security). The initial protocol handshake makes use of HTTP semantics, allowing the WebSocket protocol to reuse existing HTTP infrastructure.

Modern web browsers include a WebSocket client stack complying with the WebSocket API as specified by the W3C