send method

Future<void> send(
  1. dynamic data
)

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)));
  }
}