Protocols
Saved & recent

WebSocket

Also called: WebSockets, WS, WSS

WebSocket provides a persistent channel for text or binary messages in both directions between a client and a server. After an opening handshake, either peer can send messages without waiting for a new request. Its framing preserves message boundaries, unlike a raw TCP byte stream.

A collaborative editor can send a keystroke update and receive another person’s edit on the same connection. The original HTTP/1.1 handshake uses an Upgrade request and a 101 response; other HTTP versions have their own bootstrapping rules. Secure WebSockets use TLS. Reconnection, authorization and application acknowledgments still need an application design.

Read first
HTTP
Related
Server-sent events, Message framing, Heartbeat and keepalive
Further reading
IETF RFC 6455 — The WebSocket Protocol
client server HTTP/1.1 · Upgrade: websocket 101 Switching Protocols continuing WebSocket connection edit A edit B messages in both directions
An HTTP/1.1 opening handshake is followed by independently sent application messages. The connection stays available for both directions.

View in the full Protocols collection