The key differences between job metadata and room metadata in LiveKit are as follows:
Job Metadata:
• Job metadata is a freeform string field defined in the dispatch request and consumed in the entrypoint.
• It is used to pass complex information such as user ID, name, and phone number using JSON or similar structured data.
• It is specific to individual agent jobs and accessed through the JobContext.
Room Metadata:
• Room metadata is for application-specific data that is visible to all participants in a room.
• It can only be set using the server APIs, such as the CreateRoom and UpdateRoomMetadata APIs, but can be accessed by all participants using the LiveKit SDKs.
• It is ideal for room-wide state, configuration, and shared settings.
In summary, job metadata is used for agent-specific customization during dispatch, while room metadata is used for sharing application state across all participants in a room.
Sources:
Job lifecycle | LiveKit Docs |
Room metadata | LiveKit Docs |
State synchronization