Try a call

@rill/react

React hook for @rill/client. No extra WebRTC.

useCall returns the @rill/client Call, or null until connected. It re-renders on local, remote, state, ended, and error. Do not subscribe to data here — call call.on("data") yourself. Walkthrough: Your app.

sh
npm i @rill/react @rill/client

Until a v* tag exists, use this repo’s sdk/ workspace.

ts
import { useCall } from "@rill/react";

export function Stage({ url, token }: { url: string; token: string }) {
  const call = useCall({ url, token });
  if (!call) {
    return null;
  }
  return call.state;
}

Hook

ts
useCall(opts: ConnectOptions): Call | null
  • useCall — Connects once and re-renders on local, remote, state, ended, and error. Do not subscribe to data here: rrweb-rate messages would re-render on every payload. Apps that need data call call.on("data") themselves. No useDataChannel. Returns the @rill/client Call, or null until connected.

Type to search…

↑↓ navigate open esc close