Room

The room is the place where the actual meeting takes place. It is the place where the user can interact with other peers.

Methods

NameDescriptionParameters
connect()Connects to the room and transitions its state to "connecting."None
admitPeer(peerId)Admits a peer from the lobby to the room.peerId: string
denyPeer(peerId)Denies a peer from joining the room who is in the lobby.peerId: string
close()Closes the room for the current user and all other users.None
leave()Leaves the room for the current user while allowing it to remain active for remote participants.None

Attributes

NameDescriptionType
roomIdRoom Id of the currently joined room.string or null
lobbyPeerSetLobby peers as a Set.Set<string>
lobbyPeerIdsLobby peers as an array.string[]
configRoom configuration settings including permissions and room state.TRoomInfo["config"] (object)

Events

Event NameDescriptionReturns
room-joinedInvoked when a user successfully joins a room.None
room-joined-failedInvoked when a user's attempt to join a room fails.{ message: string, status: string }
room-closedInvoked when a room is closed.None
room-leftInvoked when a user leaves a room.None
room-connectingInvoked when a room is in the process of connecting.None
new-peer-joinedInvoked when a new peer joins the room.data (object): Information about the new peer.
lobby-peers-updatedInvoked when the list of lobby peers is updated.peerIds (array): An array of lobby peer IDs.
peer-leftInvoked when a peer leaves the room.peerId (string): The ID of the peer who left.
room-controls-updatedInvoked when the room's control settings are updated.data (object): Information about the updated control settings.

Example

// Getting room instance
const room = await huddleClient.joinRoom({
	roomId: "YOUR_ROOM_ID",
	token: "YOUR_ACCESS_TOKEN"
});
 
// Admit peer from lobby
room.admitPeer("PEER_ID");
 
// Get remote peers
const remotePeers = room.remotePeers;
 
// Event listeners for the Room events
room.on("room-joined", () => {
  console.log("You have successfully joined the room.");
  console.log("Room ID:", room.roomId);
});
 
room.on("new-peer-joined", (data) => {
  console.log("A new peer has joined the room:");
  console.log("Peer ID:", data.peerId);
});
 
room.on("room-closed", () => {
  console.log("The room has been closed.");
});
Audio/Video Infrastructure designed for the developers to empower them ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2022 Graphene 01, Inc. All Rights Reserved.