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: () => voidContract: 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
knock
void
Let the room host know that the local participant is waiting and wants to join
cancelKnock
void
Cancel the knock request
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.
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.
switchCameraEffect
(effectId: string)
void
Enable a camera effect. @whereby.com/camera-effects needs to be installed for this to work
clearCameraEffect
void
Disable a camera effect.@whereby.com/camera-effects needs to be installed for this to work
Host-only actions
When a participant provides a valid "host" roomKey in the RoomConnectionOptions when the RoomConnectionClient is initialized, they will have access to a number of addition host-only actions in rooms:
startCloudRecording
void
Start cloud recording
stopCloudRecording
void
Stop cloud recording
lockRoom
(locked: boolean)
void
Lock (true) or unlock (false) the current room
acceptWaitingParticipant
(participantId: string) => void
void
Accept waiting participant
rejectWaitingParticipant
(participantId: string) => void
void
Reject waiting participant
askToSpeak
(participantId: string)
void
Ask the specified remote participant to unmute their microphone and speak in the meeting.
This is typically useful in response to a toggleRaiseHand request from a participant in the meeting.
askToTurnOnCamera
(participantId: string)
void
Ask a participant to turn on their camera
muteParticipants
(participantIds: string[])
void
Mute the specified remote participants
turnOffParticipantCameras
(participantIds: string[])
void
Turn off the camera of the specificed remote participants
kickParticipant
(participantId: string)
void
Remove the specified remote participant from the meeting
spotlightParticipant
(participantId: string)
void
Put a spotlight on a participant.
When used in combination with the video grid, the spotlighted participant will move to the presentation stage, and their video cell will be bigger.
removeSpotlight
(participantId: string)
void
Remove spotlight on a participant.
endMeeting
(stayBehind?: boolean)
void
End the meeting for all remote participants.
If stayBehind is not provided or is not true, then the local participant will also leave the room
Events
RoomConnectionClient extends EventEmitter . You can listen to lifecycle and state change events directly:
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?

