steep-shampoo-86436
02/22/2026, 1:00 PMtall-airline-16756
02/22/2026, 1:00 PMtall-airline-16756
02/22/2026, 1:00 PMroom.metadata immediately after connect. Listen for the room_metadata_changed event and use that value. If room.metadata is already set after connect, you can use it; otherwise wait for the event.
• From a server: call the RoomService API (e.g., getRoom) to fetch the room object and read its metadata for an up-to-date value.
How to implement
1) Client-side (recommended event-driven approach)
• Subscribe to the event that fires when room metadata changes:
room.on("room_metadata_changed", (metadata) => {
console.log("Room metadata updated:", metadata);
// handle metadata here
});
• On connect, check room.metadata once. If it’s empty or stale, wait for the room_metadata_changed event. Example pattern:
if (room.metadata) {
handleMetadata(room.metadata);
} else {
room.once("room_metadata_changed", (metadata) => handleMetadata(metadata));
}
This avoids races caused by asynchronous propagation of metadata updates.
2) Server-side (direct, synchronous read)
• Use the RoomService / server SDK to fetch the room state and read metadata. Example (pseudo/Node-style):
const room = await roomService.getRoom("room-name");
console.log(room.metadata);
The server call queries the LiveKit server state and returns the current metadata immediately.
Why this matters
• Metadata updates are asynchronous and may not reach a client instantly after connect, especially across regions. Listening for room_metadata_changed ensures you receive the latest value reliably.
• The server API provides a direct read if you need synchronous access (for admin dashboards, workflows, etc.).
If you want, tell me:
• Which SDK you’re using (browser JS, iOS, Android, Python, server JS), and I’ll give a concise code snippet tailored to that environment.
• Whether you need handling for initial connect only or continuous updates for the session. Sources: Handling asynchronous metadata updates in LiveKit | LiveKit | server-sdk-js | livekit/livekit_composite | DeepWikisteep-shampoo-86436
02/22/2026, 1:03 PMtall-airline-16756
02/22/2026, 1:03 PMuser_away_timeout)
◦ Room empty/idle timeout (e.g., empty_timeout)
◦ Connection or signaling timeouts
Tell me which one and I’ll give targeted steps.
1. If you want the timeout visible to clients/agents, add it to room metadata when creating or updating the room. Example pattern (pseudo):
// server: include timeout in metadata when creating/updating the room
await roomService.updateRoom({
name: "room-name",
metadata: JSON.stringify({ user_away_timeout: 10 }) // seconds
});
Then clients can read it via room.metadata or listen for room_metadata_changed.
1. To verify the timeout is configured correctly (depending on which timeout):
◦ For agent/user inactivity: check the place it’s set (e.g., AgentSession constructor) and confirm the value (seconds).
◦ For room empty timeout: check the RoomService create/update call that sets empty_timeout.
◦ If you added the timeout to metadata: confirm the metadata contains the expected value after creation (or wait for room_metadata_changed on clients).
If you tell me which timeout you’re verifying and which SDK/environment you’re using (server SDK, browser JS, Agent code, etc.), I’ll provide the exact code snippet and a short checklist to confirm it’s applied correctly.
Sources: Handling asynchronous metadata updates in LiveKit | LiveKit | Job lifecycle | LiveKit Documentation | How to detect and handle silence during calls | LiveKit | How to implement call greeting retries in voice agents | LiveKit | server-sdk-ruby | livekit/livekit_composite | DeepWiki