Home AssistantHome AssistantContributors
In code
websocket_api/api/websockethome-assistant-js-websocket

A client connects to /api/websocket, logs in with an access token, and then sends commands as JSON messages. Integrations can add their own commands with the websocket_api integration. The frontend talks to it through the home-assistant-js-websocket library.

See the WebSocket API for the messages and how to add a command.