Skip to main content
The TruGen JS SDK client is an EventEmitter that allows you to listen to real-time session state, media streams, user speaking, and agent avatar activity.

Adding Event Listeners

Register event listeners after creating the TruGen client and before starting the session with connect().
Event handlers must be registered before the session starts. Startup events such as microphone permission, connection, and stream initialization can fire while connect() is running. Late listeners will not receive events that already fired.
Use the on or addListener methods before calling connect():

Code Examples

Connection Lifecycle

Rendering Video Stream

Custom Speaking/Listening Indicators