Skip to main content
The core SDK is event-driven. After starting a session, subscribe to events to receive streamed message chunks, tips, tool calls, and lifecycle signals. Drive your UI off these events.

Subscribing

off() requires the same function reference you passed to on(). Inline arrow functions can’t be removed — keep a reference if you need to unsubscribe.

Event reference

Use the SYNAPSE_REALTIME_EVENTS enum — never hardcode the string values.

Event payload

Every listener receives a SynapseRealTimeEventData object:

Streaming a message

A single assistant reply arrives as many MESSAGE_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.