removeAllMembers

View as Markdown

removeAllMembers

  • removeAllMembers(): Promise<void>

Removes all the members from this room session. The room session will end.

Returns

Promise<void>

Example

In this example, we wait for a room to start and then remove all the members from that room after 5 seconds. This example assumes that there is a RoomSession already active and that members are joining the room.

1import { SignalWire } from "@signalwire/realtime-api";
2
3// Initialize the SignalWire client
4const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" })
5
6// Access the video client from the main client
7const videoClient = client.video;
8
9// Setup listener for when a room starts
10await videoClient.listen({
11 onRoomStarted: async (roomsession) => {
12 console.log("Room started", roomsession.displayName);
13
14 // Remove all members from the room after 5 seconds
15 setTimeout(async () => {
16 console.log("Removing all members from room");
17 await roomsession.removeAllMembers();
18 }, 5000);
19 }
20})