The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Optionaloptions: boolean | AddEventListenerOptions(Re)broadcasts the capability announce. Also called from start when WebRTCSignalingOptions.announceOnInit is true.
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.
The peer's signaling destination hash.
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().
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.
Optionaloptions: boolean | EventListenerOptionsCreates 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.
Tears down the signaling destination and detaches listeners. Already-open WebRTC interfaces are unaffected (they live independently in the transport once registered).
Orchestrates the announce → link → SDP-exchange → data-channel lifecycle and registers each resulting
RTCDataChannelas a WebRTCInterface.Fires
WebRTCSignaling#peer
Fires
WebRTCSignaling#channel