# WebSocket

- **Canonical URL:** https://getaimath.com/dictionary/websocket/
- **Topics:** [AI APIs, Protocols & Integration](https://getaimath.com/dictionary/category/ai-apis-protocols-and-integration/)
- **Last updated:** 2026-11-25

## What is WebSocket?

**In one sentence:** A WebSocket is a connection that stays open so a client and server can send messages back and forth instantly in both directions.

Unlike normal web requests, which open and close each time, WebSockets keep a live line open. They are used for real-time voice and chat AI.

![APIs, JSON & MCP: The Drive-Thru Window & Universal Plug — Simple cartoon showing an App handing a neat checklist order slip (JSON) through a drive-thru window (API) to the AI, while a universal USB-C plug (MCP) connects the AI to Google Drive, Slack, and Email.](https://getaimath.com/diagrams/ai-apis-protocols-and-integration.png)
*Napkin Diagram (AI APIs, Protocols & Integration): An API is the drive-thru window apps use to talk to AI; JSON keeps replies neat; MCP is the universal plug for tools.*

## What is an example of WebSocket?

A live voice assistant streaming your speech to the server and receiving spoken replies over a WebSocket.

## Why does WebSocket matter?

WebSockets enable fast, two-way real-time AI conversations.

## Related Concepts

- [A2A (Agent2Agent)](https://getaimath.com/dictionary/a2a-agent2agent/): A2A, or Agent2Agent, is an open protocol that lets AI agents from different companies and frameworks talk to and work with each other.
- [Structured Data](https://getaimath.com/dictionary/structured-data/): Structured data is information organized in a clear, predictable format, like tables, spreadsheets or JSON with fixed fields.
- [Model Context Protocol (MCP)](https://getaimath.com/dictionary/model-context-protocol-mcp/): The Model Context Protocol is an open standard that lets AI apps connect to tools and data sources in one consistent way.
- [Schema Validation](https://getaimath.com/dictionary/schema-validation/): Schema validation checks whether data matches a defined schema, like the right fields and types.
- [OpenAI-Compatible API](https://getaimath.com/dictionary/openai-compatible-api/): An OpenAI-compatible API is an API that copies the request and response format of OpenAI's API, so the same code works with different providers.
- [Model Endpoint](https://getaimath.com/dictionary/model-endpoint/): A model endpoint is the specific API address or deployment where a particular model can be called.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/websocket/)
