connect method

Future connect()

Connects the link to the broker.

Implementation

Future connect() {
  _connectedCompleter ??= Completer<void>();

  if (!_configured || !_initialized) {
    init();
  }

  if (_ready) {
    link?.onConnected?.then(_connectedCompleter!.complete);
    if (link != null) link?.connect();
  } else {
    _connectOnReady = true;
  }
  return _connectedCompleter!.future;
}