connect method

Future<void> connect()

Implementation

Future<void> connect() async {
  await initialize();
  _dc = await adapter.createDataChannel(
    peerConnection: pc!,
    label: label,
    options: options,
  );
  isOfferer = true;
  _setupDataChannel(_dc!);

  final offer = await pc!.createOffer();
  await pc!.setLocalDescription(offer);
  sendSignal(SignalingMessageType.offer, {
    'sdp': offer.sdp,
    'type': offer.type.name,
    'connectionType': 'data',
  });
}