SDK Reference
Listening for Events
Listen to events during Anam AI sessions
Adding Event Listeners
After initializing the Anam client, you can register event listeners using the addListener
method:
Available Events
Event Name | Description |
---|---|
CONNECTION_ESTABLISHED | Called when the direct connection between the browser and the Anam Engine has been established |
CONNECTION_CLOSED | Called when the direct connection between the browser and the Anam Engine has been closed |
VIDEO_PLAY_STARTED | Fired when the first frames start playing during video streaming. Useful for removing loading indicators |
MESSAGE_HISTORY_UPDATED | Called with the message history transcription each time the user or persona finishes speaking |
MESSAGE_STREAM_EVENT_RECEIVED | For persona speech: Updated with each transcribed chunk as the persona speaks For user speech: Updated with complete transcription once they finish speaking |
INPUT_AUDIO_STREAM_STARTED | Called with the user’s input audio stream when microphone input has been initialized |
TALK_STREAM_INTERRUPTED | Called when the user interrupts a TalkMessageStream by speaking. Includes the interrupted stream’s correlationId |
Example Usage
Loading States
Use connection events to manage loading states:
Message History
Track conversation history:
Real-time Transcription
Monitor speech in real-time:
Was this page helpful?