ReadonlychannelsNegotiated data channels keyed by channel label.
ReadonlyconnectionNative WebRTC peer connection to the remote peer.
ReadonlyidRemote peer identifier.
Optional ReadonlymetadataMetadata advertised by the remote peer.
ReadonlyroomRoom name the peer is associated with.
Peer connection state, updated on connection state changes.
ReadonlystreamsRemote media streams keyed by stream label.
Closes a previously opened data channel to the current remote peer.
Channel label or object containing label.
Closes and frees all connection resources.
Emits an event with optional payload to the registered event handlers.
Event type to emit.
Optional arguments to pass to the event handlers.
Unregisters an event handler for a specific event type emitted by the remote peer connection.
Event type to stop listening for.
Callback function to remove from the event listeners.
Registers an event handler for a specific event type emitted by the remote peer connection.
Event type to listen for.
Callback function to handle the event.
Opens a data channel to the current remote peer.
If a channel with the same label already exists, it will be reused.
You can open a channel with the same label on both local and remote peers or only on one side. In any case, only one channel will be created for each label. You can send data through the channel in both directions.
Channel options or channel label.
Publishes new or updates an existing media stream to the current remote peer.
If you pass a MediaStream instance directly, it will be published under a label equal to the stream id. Otherwise, you can specify an explicit label in the options object. If a stream with the same label already exists, it will be updated and its tracks will be added/removed as needed to minimize renegotiations.
If the stream is published with the managed option, its tracks will be
automatically stopped when the stream is unpublished or replaced with
a new stream.
Stream descriptor or MediaStream instance.
The published MediaStream instance if successful, or undefined.
Sends a message through data channels.
If options is omitted, the message is sent to all open channels for every
connected remote peer. If options is a string, it is treated as channel label.
Message payload to send. This may be a string, a Blob, an ArrayBuffer, a TypedArray or a DataView object.
Optionaloptions: string | { label?: string }Optional channel label or object containing label.
Stops publishing a previously published media stream to the current remote peer.
If you pass a MediaStream instance directly, it will be unpublished based on its id as label. Otherwise, you can specify the label in the options object or pass it directly as a string.
If the stream was published with the managed option, its tracks will be
stopped automatically.
A stream label, MediaStream instance, or an object containing a label.
The unpublished MediaStream instance, or undefined.
Represents a remote peer connection. Do not create RemotePeer instances manually.