Back to glossary

WebSocket

A communication protocol providing full-duplex, persistent connections between client and server over a single TCP connection, enabling real-time bidirectional data exchange.

WebSockets upgrade an initial HTTP connection into a persistent, two-way channel. Unlike HTTP's request-response model where the client must initiate every interaction, WebSockets allow both the server and client to send messages at any time without the overhead of establishing new connections.

This protocol is essential for real-time features: chat applications, live dashboards, collaborative editing, streaming AI responses, and push notifications. The persistent connection eliminates the latency of repeated HTTP handshakes and the overhead of polling, making it far more efficient for high-frequency updates.

For AI products, WebSockets power streaming LLM responses where tokens are sent to the client as they are generated, creating the typewriter effect users expect. They also enable real-time collaboration features, live model inference dashboards, and instant notification systems. The main engineering considerations are connection management at scale, reconnection handling, and load balancer configuration for long-lived connections.

Related Terms