send method
Implementation
Future<void> send(dynamic data) async {
if (!open) {
logger.error(
"Connection is not open. You should listen for the `open` event before sending messages.",
);
super.emit(
"error",
Exception(
"Connection is not open. You should listen for the `open` event before sending messages.",
),
);
return;
}
if (serialization == SerializationType.JSON) {
await dataChannel?.send(RTCDataChannelMessage(jsonEncode(data)));
}
}