Skip to content
Cloudflare Docs

Waiting Room

The waiting room feature allows hosts to control who can join a meeting. When enabled, participants must wait for approval before entering the meeting.

How the Waiting Room Works

After you call meeting.join(), one of two events will occur:

  • roomJoined - You are allowed to join the meeting immediately
  • waitlisted - You are placed in the waiting room and must wait for host approval

Use meeting.self.roomState to track the user's state in the meeting.

Waiting Room States

State Flow

join()
[waitlisted] ←------ (host rejects)
↓ ↓
(host accepts) [rejected]
[joined]

Listening to State Changes

Joined Event

Triggered when the local user successfully joins the meeting:

JavaScript
meeting.self.on("roomJoined", () => {
// Local user is in the meeting
console.log("Successfully joined the meeting");
});

Waitlisted Event

Triggered when the local user is placed in the waiting room:

JavaScript
meeting.self.on("waitlisted", () => {
// Local user is waitlisted
console.log("You are in the waiting room. Waiting for host approval...");
});

Rejected Event

Triggered when the host rejects the entry request:

JavaScript
meeting.self.on("roomLeft", ({ state }) => {
if (state === "rejected") {
// Host rejected the entry
console.log("Your entry request was rejected");
}
});

Monitor State with roomState

You can also directly check the current room state:

JavaScript
const currentState = meeting.self.roomState;
if (currentState === "waitlisted") {
console.log("Waiting for approval");
} else if (currentState === "joined") {
console.log("In the meeting");
} else if (currentState === "rejected") {
console.log("Entry was rejected");
}

Host Actions

Hosts can manage waiting room requests using participant management methods. See Remote Participants for details on:

  • acceptWaitingRoomRequest(participantId) - Accept a participant from the waiting room
  • rejectWaitingRoomRequest(participantId) - Reject a participant's entry request

Example: Host Accepting Participants

JavaScript
// Get waitlisted participants
const waitlistedParticipants = meeting.participants.waitlisted.toArray();
// Accept the first waitlisted participant
if (waitlistedParticipants.length > 0) {
const participantId = waitlistedParticipants[0].id;
await meeting.participants.acceptWaitingRoomRequest(participantId);
}

Best Practices

  • Provide Clear Feedback - Show users when they're in the waiting room and that they're waiting for approval
  • Set Expectations - Let users know their request is being reviewed
  • Handle Rejection Gracefully - Provide a friendly message if entry is rejected
  • Monitor State Changes - Subscribe to room state changes to update your UI accordingly
  • Check Permissions - Ensure your app has appropriate permissions configured in the preset to use waiting room features