when calling room.prepareConnection with livekit-c...
# ask-ai
a
when calling room.prepareConnection with livekit-client Room, is there a room event to let us know that the room is prepared?
t
Thanks for reaching out, Anne. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Just a quick heads-up about the
prepareConnection
method — it doesn’t actually fire a specific room event to let you know the room is ready. Instead, it’s an asynchronous method, so you can tell it’s done by simply awaiting it. Here’s a little example:
Copy code
// JavaScript/TypeScript
try {
  await room.prepareConnection(url, token);
  console.log('Connection preparation completed');
} catch (error) {
  console.log('Connection preparation failed:', error);
}
Also, room events like
Connected
,
Reconnecting
, and
ConnectionStateChanged
are all about the actual connection state changes, not the preparation part. If you have any other questions or need a hand, just give me a shout! Sources: examples/demo/demo.ts | README.md