INDEPENDENT PERSPECTIVES. INTELLIGENT FUTURES.FOLLOW @THESITIMES ↗
The Super Intelligence Times.
AI · SUPERINTELLIGENCE · ROBOTICS · TECHNOLOGYTHE WORLD, REIMAGINED.
← Technology deskTechnology / ORIGINAL EXPLAINER

WebSockets Keep a Conversation Open

A persistent two-way connection can make live applications feel immediate.

New high-speed fibre optic data link to ALMA
New high-speed fibre optic data link to ALMA. · Illustrative archive photograph. ALMA (ESO/NAOJ/NRAO)/G. Filippi / Wikimedia Commons · CC BY 4.0. Resized for display; image rights remain with the credited creator.

Beyond repeated checking

A page that wants new information can repeatedly ask a server whether anything has changed. That approach can work, but frequent polling creates repeated requests even when there is no update. WebSockets provide a persistent connection through which both sides can send messages. This suits applications such as live collaboration, chat or rapidly changing displays. The connection is a transport mechanism, not a complete application protocol. The software still needs to define what each message means and how participants agree on the state of the conversation.

A shared editing room

In a collaborative editor, one person’s change can travel to a server and then to other participants without waiting for their next scheduled poll. That can improve the sense of immediacy. But the editor must handle two people changing related content at nearly the same time. It must also distinguish an acknowledged change from one still in transit. Keeping a connection open does not, by itself, solve ordering, conflict resolution or permission checks. Those rules belong to the application built on top.

Connections can disappear

Wireless networks change, laptops sleep and servers restart. A robust live application plans for reconnection and explains when its displayed state may be stale. It may need sequence numbers or a fresh snapshot to recover messages missed during a gap. Traffic volume also requires control so that a fast sender does not overwhelm a slower receiver. The appealing part of WebSockets is the continuous conversation. The engineering achievement is making that conversation recover gracefully when continuity is interrupted, instead of assuming a live connection will remain live forever.

Sources & further reading

MDN: WebSocket API ↗

AI-assisted editorial explainer. Sources are provided for verification.

Suggest a correction ↗

Continue reading

The Small Switch Behind the Digital World ↗

Why Silicon Became a Computing Material ↗

Why a GPU Is More Than a Graphics Chip ↗

Subscribe to the Times ↗

Explore the Times.