/** * @file RTCPeerConnection.ts * @description WebRTC peer connection driving a real ICE/DTLS/SCTP/DCEP stack. * @module peerconnection/RTCPeerConnection * * This orchestrates signaling (offer/answer + ICE candidate trickle) on top of * src/transport-stack.ts, which implements the actual on-the-wire protocols. * It interoperates with browser RTCPeerConnection for data channels. */ import { EventEmitter } from 'events'; import RTCCertificate from '../dtls/RTCCertificate'; import { RTCSessionDescription, RTCSessionDescriptionInit } from '../sdp/RTCSessionDescription'; import { RTCDataChannel, RTCDataChannelInit } from '../datachannel/RTCDataChannel'; import { TransportStack } from '../transport-stack'; /** Configuration accepted by {@link RTCPeerConnection}. */ export interface RTCConfiguration { iceServers?: unknown[]; iceTransportPolicy?: 'all' | 'relay'; certificates?: RTCCertificate[]; } export declare const RTCSignalingState: Readonly<{ STABLE: "stable"; HAVE_LOCAL_OFFER: "have-local-offer"; HAVE_REMOTE_OFFER: "have-remote-offer"; HAVE_LOCAL_PRANSWER: "have-local-pranswer"; HAVE_REMOTE_PRANSWER: "have-remote-pranswer"; CLOSED: "closed"; }>; export declare const RTCIceGatheringState: Readonly<{ NEW: "new"; GATHERING: "gathering"; COMPLETE: "complete"; }>; export declare const RTCPeerConnectionState: Readonly<{ NEW: "new"; CONNECTING: "connecting"; CONNECTED: "connected"; DISCONNECTED: "disconnected"; FAILED: "failed"; CLOSED: "closed"; }>; export declare class RTCPeerConnection extends EventEmitter { #private; constructor(configuration?: RTCConfiguration); createDataChannel(label: string, options?: RTCDataChannelInit): RTCDataChannel; createOffer(): Promise; createAnswer(): Promise; setLocalDescription(description?: RTCSessionDescriptionInit | RTCSessionDescription): Promise; setRemoteDescription(description: RTCSessionDescriptionInit): Promise; addIceCandidate(candidate: RTCIceCandidateInit | string): Promise; getConfiguration(): RTCConfiguration; setConfiguration(configuration: RTCConfiguration): void; close(): void; get signalingState(): string; get iceGatheringState(): string; get iceConnectionState(): string; get connectionState(): string; get localDescription(): RTCSessionDescription | null; get remoteDescription(): RTCSessionDescription | null; get currentLocalDescription(): RTCSessionDescription | null; get currentRemoteDescription(): RTCSessionDescription | null; get pendingLocalDescription(): RTCSessionDescription | null; get pendingRemoteDescription(): RTCSessionDescription | null; get canTrickleIceCandidates(): boolean; get sctp(): TransportStack['sctp']; } /** ICE candidate init shape (subset of the W3C dictionary). */ interface RTCIceCandidateInit { candidate: string; sdpMid?: string; sdpMLineIndex?: number; usernameFragment?: string; } export {};