What is Host Mode?
In Host Mode, your application manages the network connection to AvatarKit’s server-side SDK. Your server sends encoded messages to your client, and the client SDK receives and decodes them internally for synchronized playback and rendering.When to Use
- Custom network layer — you manage the connection between your client and AvatarKit’s server SDK yourself
- RTC integration — messages are relayed through a real-time communication server (LiveKit, Agora, etc.)
- Proxy architecture — your backend acts as a relay between the client and AvatarKit server
Requirements
| Requirement | Description |
|---|---|
| App ID | Obtained from SpatialReal Studio |
| Session Token | Not required on the client side |
| AvatarKit Server SDK | Your backend must integrate with AvatarKit’s server SDK to generate messages |
SDK Mode vs Host Mode
| Aspect | SDK Mode | Host Mode |
|---|---|---|
| Network | Client SDK connects to AvatarKit server directly | Your app relays messages from AvatarKit Server SDK |
| Message Decoding | Handled internally | Handled internally (same) |
| Session Token | Required (client-side) | Not required (client-side) |
| Server SDK | Not needed | Required on your backend |
| Key Methods | send(), start(), close() | yieldAudioData(), yieldFramesData() |
| Use Case | Simplest integration | Custom networking / RTC relay |
Key Concepts
ConversationId Management
ConversationId links audio and animation messages for a single conversation session:- Call
yieldAudioData()— returns aconversationId - Use that
conversationIdwhen callingyieldFramesData() - Messages with a mismatched conversationId will be discarded
- Use
getCurrentConversationId()to retrieve the current active session ID
Fallback Mechanism
If you provide empty animation data (empty array or undefined), the SDK automatically enters audio-only mode for that session. Once in audio-only mode, any subsequent animation data for that session is ignored — only audio continues playing.Get Started
Web Demo
GitHub demo repository
iOS Demo
GitHub demo repository
Android Demo
GitHub demo repository

