getMeta

View as Markdown

getMeta

Returns the metadata assigned to this Room Session.

Returns

Promise<{ meta: RoomSession.meta }>

A promise that resolves to a RoomSession.meta object containing the metadata assigned to this Room Session.

Example

In this example, we set metadata for a room as soon as it starts. 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 // Set the room meta
15 console.log("Setting room meta");
16 await roomSession.setMeta({
17 "foo": "bar",
18 "roomName": roomSession.displayName
19 });
20
21 // Get the room meta
22 let roomMeta = await roomSession.getMeta()
23 console.log("Room meta", roomMeta);
24 },
25 onRoomEnded: async (roomSession) => {
26 console.log("Room ended", roomSession.displayName);
27 }
28});