connect method
Connects to the Hub, authenticates and registers.
Completes once the node is registered and serving. Throws if authentication fails (a fatal, non-retryable error). Transient transport failures after a successful start trigger automatic reconnection rather than throwing.
Implementation
Future<void> connect() {
_stopped = false;
_startCleanup();
final ready = _ready = Completer<void>();
unawaited(_open());
return ready.future;
}