API Reference
    Preparing search index...

    Interface PeerOptions

    Configuration options for creating a Peer instance.

    interface PeerOptions {
        connectionTimeout?: number;
        driver?: SignalingDriver;
        iceServers?: {
            credential?: string;
            urls: string | string[];
            username?: string;
        }[];
        iceTransportPolicy?: "all"
        | "relay";
        id?: string;
        verify?: (
            options: { id: string; metadata?: any },
        ) => boolean | Promise<boolean>;
    }
    Index

    Properties

    connectionTimeout?: number

    Connection timeout in seconds. By default, it is set to 30 seconds. Use 0 to disable the timeout.

    Signaling driver instance for message exchange between peers. If omitted, a default in-memory driver is used, which is suitable for testing purposes only.

    iceServers?: { credential?: string; urls: string | string[]; username?: string }[]

    An array of objects, each describing one server which may be used by the ICE agent; these are typically STUN and/or TURN servers. If this isn't specified, the connection attempt will be made with no STUN or TURN server available, which limits the connection to local peers.

    iceServers: [{
    urls: 'stun:stun.l.google.com:19302'
    }]
    iceTransportPolicy?: "all" | "relay"

    ICE policy used by created RTCPeerConnection instances. If set to 'relay', only relay candidates will be used, otherwise all candidates will be considered.

    id?: string

    Unique peer identifier. A random UUID is generated when omitted.

    verify?: (options: { id: string; metadata?: any }) => boolean | Promise<boolean>

    Optional callback to accept or reject incoming peer connections.