Developer & Data Platforms

WebSocket

Also known as: WebSockets, WebSocket protocol, web socket

WebSocket is a communication standard that keeps a persistent, two-way connection open between a web browser or app and a server, so either side can send messages instantly at any time.

It powers real-time features such as live chat, multiplayer games, collaborative editing, stock tickers, and notifications. While regular web requests work like sending letters, WebSockets work like an open phone line, which is efficient for constant updates but requires servers to manage many open connections.

WebSocket, explained at three levels

At home

A WebSocket is like keeping a phone call open instead of sending text messages back and forth. Both sides can speak instantly whenever they want.

At work

WebSockets enable real-time features such as live dashboards and customer chat on business websites.

Real-world examples

At home

Sophie plays an online word game with friends. Their moves appear instantly on her screen thanks to a WebSocket connection.

At work

Marcus builds a live delivery-tracking dashboard for a Hamilton courier company. WebSockets push each driver's location to dispatchers in real time.

How it compares

featureWebSocketRegular HTTP request
ConnectionStays openOpens and closes
DirectionTwo-wayClient asks, server answers
Best forLive, frequent updatesOccasional requests
Server loadMany open connectionsShort-lived requests

WebSockets keep a live line open. HTTP requests are one-off letters.

For analysts

When stakeholders ask for 'real-time,' I'd clarify how fast is fast enough. Many needs are met by updates every few seconds without WebSocket complexity.

History & origin

Early web apps faked real-time updates by repeatedly asking servers for new data, a technique called polling, or holding requests open with 'long polling.' WebSocket was developed as part of HTML5 work and standardized by the IETF as RFC 6455 in 2011, with browser support arriving around the same time. It enabled chat apps, trading platforms, and online games to run smoothly in browsers. Later alternatives include server-sent events for one-way updates and WebTransport, built on HTTP/3. AI chat apps often stream responses using similar real-time techniques. In my view, WebSockets helped make the browser a true platform for live applications.