const room = await roomService.*createRoom*({ ...
# ask-ai
s
const room = await roomService.*createRoom*({ name: roomName, departureTimeout: emptyTimeout: , }); what is the default departureTimeout: emptyTimeout: , and the user is joining and then the interenet drop so it leave and comeback, i want to extend the timout so when come back the room still active
t
Thanks for reaching out, Mostafa. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your question about the default value of
departureTimeout
in
createRoom
, and how to extend it so users who briefly lose internet can come back without being removed. • The default
departureTimeout
is 20 seconds. This is the window a disconnected participant has to reconnect before LiveKit permanently removes them from the room. • The
emptyTimeout
default is 30 seconds. That controls how long a room stays open when there are no participants (it’s separate from
departureTimeout
). To give users more time to recover from a brief network drop, increase
departureTimeout
when creating the room. For example:
Copy code
const room = await roomService.createRoom({
  name: roomName,
  departureTimeout: 60, // allow 60 seconds to reconnect
  emptyTimeout: 300,    // optional: keep room open longer when empty
});
A couple of quick notes: • Increasing
departureTimeout
preserves the participant’s session/state for a longer reconnect window. • Don’t set the timeout unnecessarily high, or room/participant cleanup may be delayed in true disconnects. If you tell me what reconnection window you want (for example 30s, 60s, 2min), I can suggest values and any trade-offs for your use case. Sources: Ensuring Unique Room IDs with Dynamic Room Names | LiveKit
s
when i receive the webhook of room created i get this, it is 20 why? "metadata": "", "creationTime": "1771421613", "emptyTimeout": 300, "turnPassword": "", "numPublishers": 0, "creationTimeMs": "1771421613902", "activeRecording": false, "maxParticipants": 0, "numParticipants": 0, "departureTimeout": 20 }, "event": "room_started", "createdAt": "1771421615", "numDropped": 0 }
t
Thanks — I’m responding to your question about why the webhook for a newly created room shows
"departureTimeout": 20
. What that webhook is telling you • If you don’t explicitly set
departureTimeout
when you create the room, LiveKit uses the default of 20 seconds. The webhook shows the room’s actual runtime configuration, so seeing 20 means the room was created with the default value. • The webhook reflects the room state at creation (or when the event fired). If you set
departureTimeout
after the room was created, the webhook for the original
room_started
event will still show whatever value was present at creation. How to ensure your desired value appears in the webhook 1. Set
departureTimeout
when calling
createRoom
. Example:
Copy code
const room = await roomService.createRoom({
  name: roomName,
  departureTimeout: 60, // your desired reconnect window
  emptyTimeout: 300
});
1. Confirm the API call succeeds and returns the room object with
departureTimeout
set to your value. The room object returned by the create call should match what the webhook later reports. 2. If you update the room later via an update call, the
room_started
webhook won’t change retroactively — only subsequent events or a webhook triggered after the update will reflect the new value. If you’d like, I can help troubleshoot: • Did you include
departureTimeout
in the exact payload when calling
createRoom
? • Can you paste the code snippet you used for
createRoom
(redacting secrets)? That will help me check for any typo or missing field.