Subscribing
Event reference
Use theSYNAPSE_REALTIME_EVENTS enum — never hardcode the string values.
| Event | Fires when |
|---|---|
CONNECTED | The session connects. |
DISCONNECTED | The connection drops. Payload carries a DisconnectionReason. |
PROGRESS_MESSAGE | The agent emits an interim “working on it” status. |
MESSAGE_CHUNK | A streamed slice of the assistant’s reply. Concatenate these. |
TIPS_MESSAGE | Suggested follow-up prompts (data.tips). |
END_OF_STREAM | The current assistant message is complete. |
ERROR | A stream or server error. See error codes. |
TOOL_CALL | The agent invokes a tool / asks for input. See Tool calls. |
TOOL_START | A tool begins executing. |
TOOL_END | A tool finishes executing. |
AUDIO_TRANSCRIPT | A transcript of recorded audio. See Voice & audio. |
Event payload
Every listener receives aSynapseRealTimeEventData object:
Streaming a message
A single assistant reply arrives as manyMESSAGE_CHUNK events followed by one END_OF_STREAM. Accumulate chunks, then finalize:
Next steps
Tool calls & elicitation
Handle
TOOL_CALL events — render inputs and send results back.
