Events
Listen to conversation, avatar, and world events from an Experience.
Overview
Register handlers on an Experience instance to observe conversation, avatar, and
world activity.
Conversation
experience.on('message', ({ role, text, final }) => {
console.log(role, text, final);
});
experience.on('modeChange', ({ mode }) => {
// 'listening' | 'speaking'
});
experience.on('audio', (event) => {
// optional low-level audio hooks
}); Avatar
experience.on('viseme', (event) => { /* lip-sync timing */ });
experience.on('expression', (event) => { /* facial expression */ });
experience.on('gesture', (event) => { /* body gesture */ }); World
experience.on('stateUpdate', (patch) => { /* structured state change */ });
experience.on('locationChange', ({ locationId }) => { });
experience.on('characterEnter', ({ characterId }) => { });
experience.on('characterExit', ({ characterId }) => { });
experience.on('close', ({ reason, returnUrl }) => { }); Event reference
| Event | Payload | Description |
|---|---|---|
message | { role, text, final } | User or assistant message. final indicates end of utterance. |
modeChange | { mode } | listening or speaking |
viseme | Viseme timing data | Lip-sync keyframe for avatar animation |
stateUpdate | State patch | Structured world state change from server |
close | { reason, returnUrl? } | Session ended by user or programmatically |