Room
A Room represents a real-time communication session and is automatically created when the client calls
Space.joinRoom()
.
For joining a room, the clients needs to provide an Access Token that is usually generated by the server-side SDK.
The Access Token contains information about the room that the client is allowed to join, as well as the permissions that the client has in the room.The room manages the participants that are currently connected to the room and emits events when participants join or leave.
Each room is home for the Local Participant, which represents the local client that is currently connected to the room.
This class allows the client to publish audio and video tracks to the room.
Basic Usage
Join a room
const URL = "<serverURL>";
const TOKEN = "<token>"; // make sure to fetch the token from your backend in production
const room = space.joinRoom(URL, TOKEN);
room.on(RoomEvent.Connected, () => {
console.log("Connected to room. Listing participants:");
room.participants.forEach((participant) => {
console.log(participant);
// do something with the participant e.g setting its position in space
// ...
});
});