Skip to content
Commitwise
Menu

WebSocket

A long-lived, two-way connection between an app and a server, so the server can push data the moment it has it.

Definition

A WebSocket starts as an HTTP request and is upgraded to a persistent connection over which both sides send messages at any time. Chat, live updates and multiplayer games use them. At scale, connections live on a fleet of gateway servers, so routing a message to a user needs a shared registry or pub/sub, and anything sent over the socket must also be stored so a reconnecting client can catch up.

In practice

A chat gateway holds 100,000 open WebSockets and pushes each new message down the recipient's connection.

Related terms

Esc

Type to search the whole site.