how to use departure_timeout
# ask-ai
n
how to use departure_timeout
t
Thanks for reaching out, Mohamed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm happy to help you understand the departure_timeout parameter in LiveKit! This setting controls how long a room stays open after the last participant leaves, giving you some flexibility depending on your needs. Here are a few ways you can configure it: • Configuration File: You can set a default
departure_timeout
in the
config-sample.yaml
file under room settings. For example:
Copy code
room:
  departure_timeout: 20  # Room stays open for 20 seconds after last participant leaves
• During Room Creation: If you want to customize it when creating a room, you can specify the
departure_timeout
value directly using the CLI or API. For instance, with the CLI:
lk room create ROOM_NAME --departure-timeout 30
• Using SDKs: The
departure_timeout
field is part of the
CreateRoomRequest
message in LiveKit’s protocol buffers, so you can set it when creating a room through SDKs like the Python SDK. These SDKs also let you check this value during runtime. Just to clarify, the timeout is in seconds and it makes sure the room stays active for that amount of time after the last participant leaves before closing automatically. If you have any more questions or need help setting this up, feel free to ask—I'm here to support you! Sources: livekit-rtc/livekit/rtc/_proto/room_pb2.pyi | config-sample.yaml | cmd/lk/room.go | protobufs/livekit_room.proto
n
the room is created when user inter the meet app unsing connection-details is that correct ?
t
Absolutely! In LiveKit, a room is created automatically as soon as the very first participant joins using the connection details. This happens seamlessly during the connection process if the room isn’t already there. And don’t worry—once the last participant leaves, the room will close shortly after, with the timing nicely adjustable through the departure_timeout setting. If you have any questions about this, I’m here to help! Sources: Rooms, participants, and tracks | LiveKit Docs | Core Platform Architecture | livekit/livekit_composite | DeepWiki
n
how to set departure_timeout and where
t
I'd be happy to help you set the departure_timeout! Here are a few ways you can do it: • Configuration File: You can set the default
departure_timeout
in the
config-sample.yaml
file under room settings. For example:
Copy code
room:
  departure_timeout: 20  # Room stays open for 20 seconds after last participant leaves
• During Room Creation: You can specify the
departure_timeout
value explicitly when creating a room via the CLI or API. For example, using the CLI:
lk room create ROOM_NAME --departure-timeout 30
• Using SDKs: When creating a room programmatically, set the
departure_timeout
field in the
CreateRoomRequest
message. SDKs like the Python SDK also let you get or set this value at runtime. If you'd like, I’m here to guide you through any specific method you want to try—just let me know!