average-quill-80069
10/09/2025, 5:08 PMtall-airline-16756
10/09/2025, 5:09 PMtall-airline-16756
10/09/2025, 5:09 PMmetadata field is a flexible string, and many folks use structured formats like JSON to keep track of room-wide state or settings. Let me walk you through the two main ways to handle this:
1. When Creating a Room: You can include the metadata field right in the CreateRoom API request. Here's a quick example in TypeScript:
await roomService.createRoom({
name: 'my-room',
metadata: JSON.stringify({ game_state: { started: false } }),
});
1. Updating Metadata for an Existing Room: If you need to change the metadata later, the UpdateRoomMetadata API is your friend. Here's how you might do it in Python:
await room_service.update_room_metadata(
UpdateRoomMetadataRequest(room='my-room', metadata='new_metadata')
)
Just a heads-up: room metadata has a size limit of 64 KiB, and it's accessible to all participants through the LiveKit client SDKs. If you'd like to respond to any changes, you can listen for the RoomMetadataChanged event. I hope this helps you get started smoothly! If you have any questions along the way, feel free to ask.
Sources: livekit/livekit_room.pb.go | src/lib/controller.ts | examples/agent_dispatch.py | Room metadata | LiveKit Docs | Job lifecycle | LiveKit Docs