libp2p library
libp2p WebRTC (/webrtc, private-to-private) on dart-libp2p: signaling
over an authenticated stream, and connections whose streams are data
channels with the libp2p WebRTC message framing.
Classes
- RtcConfig
- Peer connection settings.
- WebRtcConn
-
A libp2p connection over an established WebRTC peer connection. Streams
are data channels, so it is secure (DTLS, bound to the peer IDs by the
authenticated signaling) and multiplexed without an upgrade: the swarm
adopts it as an
UpgradedTransportConn. - WebRtcStream
- A libp2p stream over one data channel, with the libp2p WebRTC message framing (spec: webrtc/README.md#multiplexing) providing half-close and reset, which data channels lack.
- WebRtcTransport
-
The libp2p
/webrtc(private-to-private) transport: peers that share a relay exchange SDP over a/webrtc-signaling/0.0.1stream on their relayed connection, then talk directly over WebRTC.
Constants
- finAckTimeout → const Duration
- How long WebRtcStream.closeWrite waits for the remote's FIN_ACK (js-libp2p uses the same).
- initChannelLabel → const String
- Label of the data channel the offerer opens so its SDP has an application section; it is closed once connected (spec: webrtc.md).
- signalingProtocol → const String
- Protocol id of the signaling stream (spec: webrtc.md).
- webRtcMuxerProtocol → const String
- js-libp2p reports this as the connection's muxer.
Functions
-
answerWebRtc(
P2PStream stream, {RtcConfig config = const RtcConfig(), Duration timeout = const Duration(seconds: 30)}) → Future< WebRtcConn> -
Runs the answering side ("B") over
stream, an inbound/webrtc-signaling/0.0.1stream. Returns the established connection. -
initiateWebRtc(
P2PStream stream, {RtcConfig config = const RtcConfig(), Duration timeout = const Duration(seconds: 30)}) → Future< WebRtcConn> -
Runs the offering side ("A" in the spec) over
stream, an outbound/webrtc-signaling/0.0.1stream on an authenticated (e.g. relayed) connection to the peer. Returns the established connection.
Exceptions / Errors
- WebRtcSignalingException
- Thrown when the SDP exchange or ICE fails.