LiveKit LogoDocs
Real-timeEgress/IngressCloudReference

Managing rooms

On this page

Initialize RoomServiceClientCreate a roomList roomsDelete a room

Initialize RoomServiceClient

Room management is done with a RoomServiceClient, created like so:

import (
lksdk "github.com/livekit/server-sdk-go"
livekit "github.com/livekit/protocol/livekit"
)
// ...
host := "https://my.livekit.host"
roomClient := lksdk.NewRoomServiceClient(host, "api-key", "secret-key")

Create a room

room, _ := roomClient.CreateRoom(context.Background(), &livekit.CreateRoomRequest{
Name: "myroom",
EmptyTimeout: 10 * 60, // 10 minutes
MaxParticipants: 20,
})

List rooms

rooms, _ := roomClient.ListRooms(context.Background(), &livekit.ListRoomsRequest{})

Delete a room

Deleting a room causes all Participants to be disconnected.

_, _ = roomClient.DeleteRoom(context.Background(), &livekit.DeleteRoomRequest{
Room: "myroom",
})

Previous

Chevron IconGenerating tokens for clients
LiveKit logo

Product

SFU

SDKs

Performance

Deployment

GitHub Logo