Docs
React SDK

React SDK

Build your call interface with RelayRTC providers, hooks and media controls.

Install

Shell
pnpm add @relayrtc/react @relayrtc/client

See installation for package requirements.

Requirements

Use React 18.3.1 or 19, a supported browser, a signaling URL and a participant token from your server. Use HTTPS outside localhost.

Wrap your call in RelayProvider and RelayRoom. Hooks read the nearest provider.

Connect a room

React
'use client'
 
import { RelayProvider, RelayRoom } from '@relayrtc/react'
 
export function Call({ token, signalingUrl }: { token: string; signalingUrl: string }) {
  return (
    <RelayProvider signalingUrl={signalingUrl}>
      <RelayRoom token={token}>
        <div>Your call interface</div>
      </RelayRoom>
    </RelayProvider>
  )
}

The SDK handles room state and media. You choose the layout, controls and participant tiles.

Hooks

HookPurpose
useRoomRoom, connection state, errors, join and leave.
useParticipantsLocal and remote participant list.
useLocalParticipantLocal identity, media controls and metadata.
useTracksFilter remote publications.
useMediaTrackBind local or remote media to an element and track playback.
useLocalMediaCamera, microphone and screen snapshots.
useMessagesLocal message history and sending.
useConnectionQualityRoom and participant network quality.

Components

Use MediaLoader to show loading. The SDK does not include a prebuilt Zoom-style call layout.

Server work

Create rooms, issue tokens and administer participants with the Node SDK or REST API. Keep secret API keys out of this package.