WebSocket
A persistent, full-duplex connection between browser and server, replacing repeated request-response with an open channel.
WebSocket is a protocol that upgrades a single HTTP request into a persistent, bidirectional connection: once established, either side can send a message at any time, with no new request needed and no polling. It's the standard answer to "the server needs to tell the browser something happened," which plain HTTP's request-response model has no native way to do — the server can only ever reply to a request the client already made.
The handshake is the clever part: a client sends a normal HTTP request with an Upgrade: websocket header, the server replies 101 Switching Protocols, and from that point the same TCP connection carries WebSocket frames instead of HTTP. This is why WebSocket traffic passes through most existing infrastructure — load balancers, proxies — that already understands HTTP's initial handshake, even though what flows afterward isn't HTTP anymore.
Before WebSocket existed, the workaround was long polling: the client holds a request open until the server has something to say, then immediately reopens another one. It works, but at the cost of connection overhead and latency that a genuinely persistent connection avoids. Server-Sent Events cover the server pushes to client half of that gap with a simpler, HTTP-native mechanism, but only in that one direction; WebSocket is the choice when the client needs to push too — chat, collaborative editing, live multiplayer state.
The tradeoff is statefulness: a WebSocket connection is pinned to one server process for its lifetime, which complicates horizontal scaling and deployment in a way that stateless HTTP requests don't — a rolling deploy has to account for existing connections rather than just routing the next request to a new instance. See Zero-Downtime Deployment for the general shape of that problem.
See also5
Optimistic UI
Updating the UI as if a server request has already succeeded, before the server has actually responded.
Web Platform9 connections
Zero-Downtime Deployment
Deploying a new version while the service keeps serving every request, with no maintenance window.
Version Control & Delivery8 connections
Same-Origin Policy
The browser rule isolating documents by scheme, host, and port, and the mechanisms for relaxing it.
Web Platform15 connections
HTTP2 and HTTP3
Two successive rewrites of HTTP's transport layer, each solving the previous version's head-of-line blocking at a different layer.
Web Platform6 connections
Streaming Response
Delivering a response incrementally as it is produced rather than all at once when complete.
Networks & Distribution17 connections
Related1
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from4
- Debounce and ThrottleWeb Platform
Two opposite strategies for limiting how often a handler runs against a rapid stream of events.
- HTTP2 and HTTP3Web Platform
Two successive rewrites of HTTP's transport layer, each solving the previous version's head-of-line blocking at a different layer.
- Optimistic UIWeb Platform
Updating the UI as if a server request has already succeeded, before the server has actually responded.
- WebhookNetworks & Distribution
A webhook is an HTTP callback a service pushes to you when an event happens, inverting who initiates the request.