creamy-tiger-14805
09/11/2025, 12:11 PMtall-airline-16756
09/11/2025, 12:11 PMtall-airline-16756
09/11/2025, 12:11 PMRoom
object and you can easily access them through server-side APIs or client SDKs.
Here’s a simple way to map between them:
• You can use the ListRooms API, which gives you a list of rooms including both sid
(room_id) and name
(room_name).
• From the client SDKs, once you’re connected to a room, you can access room.name
and room.sid
(or their equivalents) at the same time.
Just a quick heads-up: if you reuse the same room_name
shortly after deleting a room, the same room_id
might be reused as well. To keep things unique and avoid any confusion, it’s a good idea to use unique names when creating new rooms.
Sources: Sources/LiveKit/Core/Room.swift | lib/livekit/proto/livekit_models_pb.rb | livekit/livekit_room.pb.go | src/room/Room.ts | livekit-rtc/livekit/rtc/_proto/room_pb2.pytall-airline-16756
09/11/2025, 12:12 PMRoom
object and you can easily access them through the server-side APIs or client SDKs.
Here’s how you can create this mapping:
• Use the ListRooms API, which provides a list of rooms including both sid
and name
fields.
• In the client SDKs, you can access the Room
object directly, where both room.name
and room.sid
are available for your use.
Just a quick heads-up: if you reuse the same room_name
shortly after deleting a room, the same room_id
might be reused. To keep things smooth and avoid any conflicts, it’s best to ensure the room_name
is unique when creating new rooms.creamy-tiger-14805
09/11/2025, 12:12 PMtall-airline-16756
09/11/2025, 12:13 PMfrom livekit import api
import asyncio
async def map_room_id_to_name():
# Initialize the LiveKit API client
lkapi = api.LiveKitAPI()
# List all active rooms
rooms_response = await lkapi.room.list_rooms(api.ListRoomsRequest())
# Create a mapping from room SID to room name
room_mapping = {room.sid: room.name for room in rooms_response.rooms}
print("Room ID (SID) to Room Name Mapping:", room_mapping)
await lkapi.aclose()
return room_mapping
# Run the async function
if __name__ == "__main__":
asyncio.run(map_room_id_to_name())
Output Example:
{
"RM_abc123": "my-room",
"RM_xyz789": "another-room"
}
This snippet uses the list_rooms
method from the RoomService
API to fetch all active rooms and neatly map each sid
to its name
. If you have any questions or want to explore this further, just let me know—I'm here to help!
Sources: examples/api.py