send method

Future<bool> send(
  1. String message, {
  2. bool? asBinary,
  3. int? maxPartSize,
})

Implementation

Future<bool> send(String message, {bool? asBinary, int? maxPartSize}) async {
  bool ok = true;

  busy = true;

  // ensure broker is started
  ok = await start();
  if (!ok) return ok;

  // message is a file pointer?
  File? file =
      scope!.files.containsKey(message) ? scope!.files[message] : null;

  // send message
  if (file == null) {
    ok = await _send(message, asBinary: asBinary, maxPartSize: maxPartSize);
  } else {
    ok = await _sendFile(file, asBinary: asBinary, maxPartSize: maxPartSize);
  }

  busy = false;

  return ok;
}