createLink method

  1. @override
Future<RtcPeerLink> createLink(
  1. String peerKey, {
  2. List<Map<String, Object?>> iceServers = const [],
})
override

Builds a connection to one peer. Does not begin negotiation.

peerKey identifies the remote peer — a node uId, not an endpoint id. One link is shared by every stream between this pair.

iceServers is in the standard {'urls': ..., 'username': ...} form. Empty means host candidates only: pure LAN peer-to-peer, no third party involved. See RtcTransportConfig.iceServers for why that is the default.

Implementation

@override
Future<RtcPeerLink> createLink(
  String peerKey, {
  List<Map<String, Object?>> iceServers = const [],
}) async {
  if (_closed) throw StateError('Adapter for $selfKey is closed');
  final existing = _links[peerKey];
  if (existing != null) return existing;
  return _pendingLinks[peerKey] ??= _createLink(peerKey);
}