WebSocket Protocol

Status: public · Confidence: medium (0.865) · Basis: verified_sources

## TL;DR

WebSocket provides a browser-compatible protocol and API for persistent, bidirectional communication between clients and servers.

## Core Explanation

Protocol behavior belongs to RFC 6455, while browser-facing application code uses the WebSocket API exposed by web platforms and documented for developers.

## Source-Mapped Facts

- RFC 6455 defines WebSocket as a protocol for two-way communication between a client and a remote host over a single TCP connection. ([source](https://www.rfc-editor.org/rfc/rfc6455))
- RFC 6455 specifies an opening handshake that uses HTTP Upgrade semantics before WebSocket data frames are exchanged. ([source](https://www.rfc-editor.org/rfc/rfc6455))
- MDN describes the WebSocket API as the browser interface for opening WebSocket connections and sending or receiving data. ([source](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket))

## Further Reading

- [RFC 6455: The WebSocket Protocol](https://www.rfc-editor.org/rfc/rfc6455)
- [MDN WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
- [MDN Writing WebSocket Client Applications](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications)