AI Dictionary › Fondamenti AI

WebSocket

WebSocket is a protocol that establishes a persistent, bidirectional communication channel between browser and server: once the connection is open, both sides can send messages at any moment, with no need for the client to ask. It goes beyond HTTP's request-response model, where the server may speak only when spoken to.

Definition

What it is

WebSocket is a protocol that establishes a persistent, bidirectional communication channel between browser and server: once the connection is open, both sides can send messages at any moment, with no need for the client to ask. It goes beyond HTTP's request-response model, where the server may speak only when spoken to.

How it works

The connection starts as a normal HTTP request with an upgrade handshake: if the server accepts, the channel turns into a WebSocket and stays open. From then on, messages travel both ways with minimal overhead and very low latency, ideal for small, frequent updates. The protocol includes ping-pong frames to keep the connection alive, with reconnection handled by the application.

Applications

In AI, WebSockets power real-time experiences: assistant voice APIs (speech-to-speech conversation with natural interruptions) run over WebSocket, as do many chats receiving streamed tokens and dashboards showing live agent status. Beyond AI they drive chat apps, multiplayer games, stock tickers and collaborative documents.

History & etymology

The protocol was born within the HTML5 effort: the first proposal dates to 2008, with Ian Hickson among the specification's protagonists, and standardization came in December 2011 with IETF RFC 6455. The name joins web and socket, the historic networking term (borrowed from electrical outlets) for the endpoint of a communication channel: literally, a connection socket for the web.

Definizione (italiano)

WebSocket è un protocollo che stabilisce un canale di comunicazione bidirezionale e persistente tra browser e server: una volta aperta la connessione, entrambe le parti possono inviarsi messaggi in qualunque momento, senza che il client debba chiedere. Supera il modello richiesta-risposta di HTTP, dove il server può parlare solo se interrogato.

La connessione inizia come una normale richiesta HTTP con un handshake di upgrade: se il server accetta, il canale si trasforma in WebSocket e resta aperto. Da quel momento i messaggi viaggiano nei due sensi con overhead minimo e latenza bassissima, ideali per aggiornamenti frequenti e piccoli. Il protocollo prevede ping-pong per tenere viva la connessione e riconnessioni gestite dall'applicazione.

Nell'AI i WebSocket alimentano le esperienze in tempo reale: le API vocali degli assistenti (conversazione speech-to-speech con interruzioni naturali) viaggiano su WebSocket, così come molte chat che ricevono i token in streaming e le dashboard che mostrano lo stato degli agenti in diretta. Fuori dall'AI muovono chat, giochi multiplayer, quotazioni di borsa e documenti collaborativi.

Il protocollo nacque nell'ambito del lavoro su HTML5: la prima proposta risale al 2008, con Ian Hickson tra i protagonisti della specifica, e la standardizzazione arrivò nel dicembre 2011 con la RFC 6455 dell'IETF. Il nome unisce web e socket, il termine storico delle reti (dalle prese elettriche) che indica l'estremità di un canale di comunicazione: letteralmente, una presa di connessione per il web.

Related terms

More in Fondamenti AI

Put it into practice

From our network

AGORÀ Intelligence — Enterprise AI Governance Platform

Govern AI at scale: policies, adoption and measurable results on your data. Built for boards and C-suite.

Visit agora-intelligence.com →

From the Agora Intelligence blog

More on agora-intelligence.com →

📱 Download the Android app (beta) iOS coming soon

Say what you mean. Get what you need.

Grace Certified — the AI coach that trains and certifies your prompt engineering — by Agora Intelligence.