deleteMeta

View as Markdown

deleteMeta

  • deleteMeta(keys): Promise<void>

Deletes the specified keys from the metadata for this RoomSession.

Parameters

keys
string[]Required

The keys to remove.

Returns

Promise<void>

Example

In this example, we set metadata for a room as soon as it starts. After 5 seconds, we remove the metadata for that room. Once the room’s metadata is set or removed, we log the metadata for that 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
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 await roomSession.setMeta({
14 "foo": "bar",
15 "roomName": roomSession.displayName
16 });
17 let roomMeta = await roomSession.getMeta()
18 console.log("Room meta", roomMeta);
19
20 // delete room meta after 5 seconds
21
22 setTimeout(async () => {
23 console.log("Deleting room meta");
24 await roomSession.deleteMeta(["foo"]);
25 roomMeta = await roomSession.getMeta()
26 console.log("Room meta", roomMeta);
27 }, 5000);
28
29 },
30 onRoomEnded: async (roomSession) => {
31 console.log("Room ended", roomSession.displayName);
32 }
33});