reticulum-js
    Preparing search index...

    Class WebRTCSignaling

    Orchestrates the announce → link → SDP-exchange → data-channel lifecycle and registers each resulting RTCDataChannel as a WebRTCInterface.

    WebRTCSignaling#peer

    WebRTCSignaling#channel

    Hierarchy

    • EventTarget
      • WebRTCSignaling
    Index
    _announceListener: ((event: Event) => void) | null = null
    _linkRequestListener: ((event: Event) => void) | null = null
    _pending: Set<string> = ...
    _started: boolean = false
    announceOnInit: boolean
    answerTimeoutMs: number
    channelOpenTimeoutMs: number
    createPeerConnection: ((config?: RTCConfiguration) => any) | null
    destination: Destination | null
    destinationName: string
    extraAppData: Uint8Array<ArrayBufferLike> | null
    iceGatheringTimeoutMs: number
    identity: Identity | null
    rtcConfig: RTCConfiguration
    • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Initiates a WebRTC connection to a peer whose destination hash was learned from a "peer" event (or otherwise known). Runs the initiator half of the lifecycle: recall the peer identity, open a link, create the data channel, gather ICE, send the offer as a Resource, await the answer Resource, set the remote description, and adopt the opened channel as an interface.

      Rejects if the peer identity is unknown (wait for its announce), the RTCPeerConnection factory is missing, or any negotiation step fails.

      Parameters

      • peerDestinationHash: Uint8Array<ArrayBufferLike>

        The peer's signaling destination hash.

      Returns Promise<WebRTCInterface>

      The registered interface wrapping the opened data channel.

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      • event: Event

      Returns boolean

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Creates the signaling destination, registers it, subscribes to transport announce events and incoming link requests, and (unless WebRTCSignalingOptions.announceOnInit is false) announces. Must be called (and awaited, or via WebRTCSignaling#startPromise) before WebRTCSignaling#connect or the responder role will work.

      Idempotent.

      Returns Promise<void>

    • Tears down the signaling destination and detaches listeners. Already-open WebRTC interfaces are unaffected (they live independently in the transport once registered).

      Returns void