MockRTC API Reference
    Preparing search index...

    Interface MockRTCConnection

    An RTC connection is a single connection. This base class defines the raw connection management and tracking logic for a generic connection. The MockRTCConnection subclass extends this and adds logic to support control channels, proxying and other MockRTC-specific additions.

    interface MockRTCConnection {
        id: `${string}-${string}-${string}-${string}-${string}`;
        sessionApi: MockRTCSession;
        get channels(): readonly DataChannelStream[];
        get localChannels(): readonly DataChannelStream[];
        get localMediaTracks(): readonly MediaTrackStream[];
        get mediaTracks(): readonly MediaTrackStream[];
        get metadata(): ConnectionMetadata;
        get remoteChannels(): readonly DataChannelStream[];
        get remoteMediaTracks(): readonly MediaTrackStream[];
        buildLocalDescription(): Promise<MockRTCSessionDescription>;
        close(): Promise<void>;
        createDataChannel(label: string): DataChannelStream;
        getLocalDescription(): MockRTCSessionDescription & ParsedSDP | undefined;
        getMirroredLocalAnswer(
            sdpToMirror: string,
        ): Promise<MockRTCSessionDescription>;
        getMirroredLocalOffer(
            sdpToMirror: string,
            options?: { addDataStream?: boolean },
        ): Promise<MockRTCSessionDescription>;
        getRemoteDescription(): RTCSessionDescriptionInit & ParsedSDP | undefined;
        getSelectedCandidates(): | {
            local: { protocol: string; type: RTCIceCandidateType };
            remote: { protocol: string; type: RTCIceCandidateType };
        }
        | undefined;
        proxyTrafficTo(externalConnection: RTCConnection): Promise<void>;
        proxyTrafficToExternalConnection(): Promise<RTCConnection>;
        setRemoteDescription(description: RTCSessionDescriptionInit): void;
        waitUntilConnected(): Promise<void>;
    }

    Hierarchy (View Summary)

    Index
    id: `${string}-${string}-${string}-${string}-${string}` = ...
    sessionApi: MockRTCSession = ...
    • Returns
          | {
              local: { protocol: string; type: RTCIceCandidateType };
              remote: { protocol: string; type: RTCIceCandidateType };
          }
          | undefined