transports/webrtc library
The WebRTC transport for peer_coordinator.
Import this alongside package:peer_coordinator/peer_coordinator.dart to
coordinate over direct peer-to-peer data channels instead of a relay. The
hub is still needed — for discovery and for carrying signalling — but it is
off the data path.
This package is pure Dart and ships no WebRTC implementation. Supply an
RtcPeerAdapter: webrtc_coordinator_flutter provides one backed by
flutter_webrtc, and package:webrtc_coordinator/testing.dart provides a
fake for tests.
Classes
- RtcChannel
- One data channel, carrying one NetworkStream's traffic to one peer.
- RtcChannelEvent
- A data channel that has just come into existence.
- RtcCoordinationStream
- Coordination stream over a data channel. Reliable, ordered, JSON.
- RtcDataStream
- Data stream over a data channel.
- RtcMesh
- Owns one RtcPeerLink per remote peer, and the channels on it.
- RtcNetworkStreamFactory
- Builds WebRTC streams for a session.
- RtcPeerAdapter
- Creates and owns peer connections.
- RtcPeerLink
- A connection to one peer.
- RtcSignal
- One signalling message between two peers.
- RtcTransport
- Coordination over direct WebRTC data channels.
- RtcTransportConfig
- Configuration for the WebRTC transport.
Enums
- RtcLinkState
- Connection state, reduced to what the transport actually branches on.
- RtcSignalKind
- What a signal is.
Mixins
-
RtcStreamMixin<
T extends NetworkStreamConfig, M extends IMessage< IMessageType> > - Shared behaviour for streams carried on WebRTC data channels.
Constants
- coordinationChannelId → const int
- The coordination stream's reserved channel id.
- coordinationChannelName → const String
- The coordination stream's name, pinned to coordinationChannelId.
- maxChannelId → const int
- The highest legal SCTP stream id.
- reservedChannelIds → const int
- Ids below this are reserved; rtcChannelIdFor never returns one.
Functions
-
rtcChannelIdFor(
String streamName) → int -
The data-channel id for
streamName, derived identically on both peers.
Typedefs
- RtcAdapterFactory = RtcPeerAdapter Function(String selfNodeUId)
- Builds the WebRTC implementation for one node.