lock

View as Markdown

lock

  • lock(params): Promise<void>

Locks the room. This prevents new participants from joining the room.

Returns

Promise<void>

Example

In this example, we wait for a room to start and then lock the room. This prevents new participants from joining the room. This example assumes that there is a RoomSession already active and that members are joining the room.

1import { SignalWire } from "@signalwire/realtime-api";
2
3const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" })
4
5const videoClient = client.video;
6
7// Setup listener for when a room starts
8await videoClient.listen({
9 onRoomStarted: async (roomsession) => {
10 // Lock the room
11 console.log('Locking room');
12 await roomsession.lock();
13 }
14})