Watch a call's events live: transcripts, speech, tool calls, hangup

wss://api.hilus.ai/Platform/calls/{call_id}/events

Watch a call's events live: transcripts, speech, tool calls, hangup.

Read-only: the socket observes a call that is already running and never changes it. Within half a second of connecting you may send one config frame choosing the channels: 0 (caller), 1 (assistant, the default), "all" or "both", or "0,1". The server then sends event / connected with the call's status, provider and channels, and one event frame per pipeline event (audio excluded). The stream ends with an event / hangup frame. An unknown call gets an error frame and the socket closes.

Args: call_id: Id of the Call entity to watch.

Heartbeat: the server pings every 25.0s; answer each with {"type": "pong"}.

Close codes

Code Meaning
1000 Normal close; also sent when the client stops answering heartbeat pings.
1003 No WebSocket route at this path.
1008 Policy violation: credential not accepted for this route, missing scope or role, or invalid connection parameters (the reason names them).
1011 Server error while handling the connection.
1012 Server restarting; reconnect.
1013 Rate or concurrency limit reached; retry later.
4001 Session expired or missing; re-authenticate (reload) and reconnect.
4002 Closed for inactivity (no real client frame within the idle timeout); reconnect at once only to resume a conversation the server has stored, otherwise when the user acts again.
4003 Credential of the wrong kind for this route; do not retry with the same credential.

Example

// Mint a short-lived session token on your server; never put an API key in a browser or a URL.
const socket = new WebSocket("wss://api.hilus.ai/Platform/calls/{call_id}/events?token=" + HILUS_SESSION_TOKEN);