Docs
React SDK

RelayRoom

Join with a participant token and leave when the component unmounts.

Import

React
import { RelayRoom } from '@relayrtc/react'

Requirements

Render inside RelayProvider. Only one RelayRoom owns a provider at a time.

Props

PropTypeDefaultPurpose
tokenstring, null or undefinedRequired propToken issued by your backend. Null/undefined waits without joining.
connectbooleantrueEnable the automatic join.
childrenReactNodeOptionalRoom UI; rendered while connecting too.
onConnected(room: Room) => voidOptionalCalled when a new room becomes available.
onDisconnected() => voidOptionalCalled when the previously available room is removed.
onError(error: RoomError) => voidOptionalObserve room errors.

Example

React
<RelayRoom
  token={participantToken}
  onConnected={(room) => console.log('Joined', room.id)}
  onDisconnected={() => console.log('Left')}
>
  <YourCall />
</RelayRoom>

Token changes

Changing the token starts a new join lifecycle. Unmounting cancels an in-flight join and releases room ownership.

Joining does not enable local capture. Call camera or microphone controls after the room is connected.