WebSocket
Also called WebSockets, WS
A protocol that keeps a connection open between a browser and a server so both sides can send messages at any time. It suits live, two-way features such as chat and voice.
What is a WebSocket?
A WebSocket is a persistent, two-way connection between a client, usually a browser, and a server. Once it is open, either side can send data whenever it likes, without the client having to ask again each time. The protocol is defined in RFC 6455.
How does it work?
The connection begins as a normal HTTP request that asks to switch protocols. After the handshake, the same connection carries messages in both directions until one side closes it. Addresses start with ws:// for plain connections or wss://, the encrypted form, which is what you should use in production.
What is a simple example?
A live voice assistant sends microphone audio to a server and receives transcribed text and spoken replies back at the same time over one WebSocket. Because both directions stay open, the conversation feels immediate.
Why does it matter?
Real-time AI features, such as voice agents and collaborative tools, need low-delay traffic in both directions. If the server only needs to stream results to the client, server-sent events are often simpler. The AG-UI protocol can be carried over either approach.