UNPKG

@rtcio/react

Version:

A wrapper around the @rtcio/core library for React integration

27 lines 1.31 kB
import { P2PConnection, PeerId, RTC, RtcOptions, VoidMethods } from "@rtcio/core"; import { ReactNode, RefObject } from "react"; import { Option } from "@dbidwell94/ts-utils"; export interface P2PContext<TEvents extends VoidMethods<TEvents> = Record<string, never>> { rtc: Option<{ rtc: RTC<TEvents>; myId: PeerId; }>; peerIds: PeerId[]; peers: RefObject<Map<PeerId, P2PConnection<TEvents>>>; signalerPeers: PeerId[]; } export interface P2PProps extends RtcOptions { /** * If the ClientSignaler doesn't support real time events, * then we must poll the signaler to get the current list of * peers in the room. If this property is set, then we will * poll for signaler peers at the specified interval. Otherwise * we will be listening for a peer connected event from the * ClientSignaler */ pollSignalerInterval?: number; children?: ReactNode; } export declare const p2pContext: import("react").Context<P2PContext<Record<string, never>>>; export default function P2PProvider<TEvents extends VoidMethods<TEvents> = Record<string, never>>({ roomName, signaler, children, dataTimeoutMs, iceServers, maxChunkSizeBytes, pollSignalerInterval, }: P2PProps): import("react/jsx-runtime").JSX.Element; //# sourceMappingURL=Provider.d.ts.map