creamy-window-79763
12/11/2025, 1:48 PMtall-airline-16756
12/11/2025, 1:48 PMtall-airline-16756
12/11/2025, 1:48 PMctx.job.room.metadata and ctx.room.metadata, and how those values get set.
• Difference:
◦ ctx.job.room.metadata is the room metadata as captured on the job object at dispatch time (available before you connect).
◦ ctx.room.metadata is the room metadata on the live Room instance after the agent connects and reflects the current room state.
◦ They refer to the same underlying room metadata value; they can differ only if the room metadata was changed between job dispatch and when the agent connected.
• How they're populated:
◦ Room metadata is set server-side when a room is created or updated (e.g., via server APIs like create/update room metadata or via RoomConfiguration in access tokens).
◦ That server-set metadata is synchronized to participants and agents; ctx.job.room.metadata captures the value at dispatch, ctx.room.metadata shows the live value after connection.
Would you like me to show where to read/update room metadata or an example call to update it?
Sources: Job lifecycle | LiveKit docs | Room metadata | LiveKit docs | Authentication | LiveKit docscreamy-window-79763
12/11/2025, 1:51 PMtall-airline-16756
12/11/2025, 1:51 PMctx.job.room.metadata. It exists on the job object at dispatch and is available before you call ctx.connect(), so it won't depend on the live room connection timing.
• Why: ctx.job.room.metadata reflects the room state captured at job dispatch. ctx.room.metadata is only populated after the agent connects and may be empty if you try to read it before or if the room state changed between dispatch and connect.
• Best practices to avoid missing values:
◦ Read ctx.job.room.metadata in the entrypoint before calling ctx.connect().
◦ If you must use ctx.room.metadata, call it only after a successful ctx.connect() and consider waiting for room state sync events.
◦ Validate metadata at room creation (server-side) and confirm the create/update API returned the expected value.
◦ Add defensive checks: if ctx.job.room.metadata is empty, retry a short delay and then check ctx.room.metadata after connect.
Quick question to help diagnose: when you say "cannot be found inside the entrypoint," are you reading metadata before or after ctx.connect()? Also, can you share a minimal code snippet showing where you read the metadata?