RoomConnectionClient
const roomConnection = client.getRoomConnection()
RoomConnectionClient manages entire room connection. It exposes state subscriptions and provides actions to manage and observe remoteParticipants and in room actions. Room connection s retrieved from the WherebyClient.
Utilities
getState
RoomConnectionState
Returns the entire room connection state
destroy
void
Destroy the RoomConnectionClient instance.
State Subscriptions
All subscribe methods follow this format:
Call signature:
subscribeX(callback: (payload: T) => void: () => void
Contract: Invokes a callback on initial subscription and whenever the state changes.
Returns: an unsubscribe function
Methods
subscribeToCloudRecording
status: { status: "recording" } | undefined
Emits cloud recording status
subscribeToLiveStream
status: { status: "streaming" } | undefined
Emits streaming status
subscribeToRemoteParticipants
participants:
RemoteParticipantState
[]
Emits the remote participant state
Actions
void
Let the room host know that the local participant is waiting and wants to join
setDisplayName
(displayName: string)
void
Change your display name
sendChatMessage
(text: string)
void
Send a chat message to the room
toggleCamera
(enabled?: boolean)
void
Change the state of your camera
toggleMicrophone
(enabled?: boolean)
void
Change the state of your microphone
toggleLowDataMode
(enabled?: boolean)
void
Change the state of low data mode
toggleRaiseHand
(enabled?: boolean)
void
Toggle raising and lowering your hand in the meeting. Any host in the meeting can acknowledge your request with the askToSpeak
host action.
acceptWaitingParticipant
(participantId: string) => void
void
Accept waiting participant
rejectWaitingParticipant
void
Reject waiting participant
startScreenshare
void
Start screen share
stopScreenshare
void
Stop screen share
leaveRoom
void
Leave the room
joinBreakoutGroup
(group: string)
void
Join a breakout group.
joinBreakoutMainRoom
void
Join the main room in a breakout session.
Events
RoomConnectionClient
extends EventEmitter
. You can listen to lifecycle and state change events directly:
import { REMOTE_PARTICIPANTS_CHANGED } from "@whereby.com/core";
const roomConnection = client.getRoomConnection();
function logChatMessage(message: ChatMessage) {
console.log("New chat message received", message);
}
roomConnection.on(REMOTE_PARTICIPANTS_CHANGED, logChatMessage);
RoomConnectionEvents
CLOUD_RECORDING_STATUS_CHANGED
cloud-recording:status-changed
status: { status: "recording" } | undefined
Cloud recording is started or stopped
CONNECTION_STATUS_CHANGED
connection:status-changed
status:
ConnectionStatus
There's a change to connection status
LOCAL_PARTICIPANT_CHANGED
local-participant:changed
participant?:
LocalParticipantState
There's a change to the local participant state
LOCAL_SCREENSHARE_STATUS_CHANGED
local-screenshare:status-changed
status?:
LocalScreenshareStatus
Local screenshare is started or stopped
REMOTE_PARTICIPANTS_CHANGED
remote-participants:changed
participants:
RemoteParticipantState
[]
There's a change to the remote participant state
SCREENSHARE_STARTED
screenshare:started
screenshares:
ScreenshareState
[]
Remote screenshare is started or stopped
ROOM_JOINED_ERROR
room:joined:error
error: RoomJoinedErrors | string
A client leaves the room
WAITING_PARTICIPANT_JOINED
waiting-participant:joined
participant:
WaitingParticipantState
A client joins the waiting room
WAITING_PARTICIPANT_LEFT
waiting-participant:left
participantId: string
A client leaves the waiting room
SPOTLIGHT_PARTICIPANT_REMOVED
spotlight:participant-removed
participantId: string
A client is removed from the spotlight
STREAMING_STOPPED
streaming:stopped
void
Streaming is stopped
Last updated
Was this helpful?