What is a WebSocket?

Definition

A WebSocket begins with a web-compatible handshake and then keeps a full-duplex connection open. Both client and server can send messages whenever new information is available instead of creating a separate request for every update.

Real-time systems use WebSockets for market data, chat, dashboards and event streams. Compared with periodic polling, a persistent connection can reduce delay and repeated request overhead, although applications must handle disconnects, authentication, message ordering and recovery.

Acronyms and aliases

WebSocket connection variantWebSockets variant

Frequently asked questions

How is a WebSocket different from polling?

A WebSocket keeps a two-way connection open, while polling repeatedly asks the server whether new information is available.

Why do trading bots use WebSockets?

They provide timely market updates and order events without waiting for the next scheduled polling request.

Videos explaining WebSocket