send method

  1. @override
Future<void> send(
  1. RTCDataChannelMessage message
)
override

Send a message to this datachannel. To send a text message, use the default constructor to instantiate a text RTCDataChannelMessage for the message parameter. To send a binary message, pass a binary RTCDataChannelMessage constructed with RTCDataChannelMessage.fromBinary

Implementation

@override
Future<void> send(RTCDataChannelMessage message) async {
  await WebRTC.invokeMethod('dataChannelSend', <String, dynamic>{
    'peerConnectionId': _peerConnectionId,
    'dataChannelId': _dataChannelId,
    'type': message.isBinary ? 'binary' : 'text',
    'data': message.isBinary ? message.binary : message.text,
  });
}