my simli avatar takes a long time to connect, how ...
# ask-ai
c
my simli avatar takes a long time to connect, how can I speed up the time it takes for the simli avatar to join the room?
t
Thanks for reaching out, Aaron. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To speed up the time it takes for your Simli avatar to join the room, you can try the following strategies: • Use a "Warm" Token: Generate a token for the user at login with a long expiration time. This way, the token is already available in your frontend when you need to connect to the room, avoiding delays caused by token generation. • Dispatch the Agent During Token Generation: Optimistically create a room and dispatch the agent at the same time the token is generated. This allows the user and the agent to connect to the room simultaneously. • Pre-Warm the Connection: Use the
prepareConnection
method to pre-warm the connection before actually connecting. For example:
Copy code
// call this some time before actually connecting to speed up the actual connection
room.prepareConnection(url, token);
These methods help reduce the sequential steps needed for connection and improve the overall connection time. Let me know if you need further assistance! Sources: Web and mobile frontends | LiveKit Docs | GitHub::livekit::livekit_composite | livekit/client-sdk-js/README.md