start method

Future<void> start()

Binds the TLS endpoint and starts the liveness watchdog.

Implementation

Future<void> start() async {
  if (_server != null) return;
  await _resolveUid();
  _startTunnelTls();

  // Mounted at '/', which matches every path — a standalone Hub upgrades a
  // WebSocket regardless of what the peer asked for, and clients dial the bare
  // authority (`wss://host:8443`).
  final server = omnyhub.OmnyHub(
    transports: [
      omnyhub.HttpTransport.https(
        address: config.host,
        port: config.port,
        tls: _tls(),
      ),
    ],
    // Without this the hub's own lifecycle, TLS-renewal and unhandled-error
    // messages would go to omnyhub's default NoopLogger and vanish.
    logger: _BridgeLogger(config.logger),
    // Drives the certificate re-check: on renewal omnyhub rebinds the listener
    // gap-free, so established connections drain on the old one while new ones
    // land on the fresh certificate.
    tlsRenewalInterval: config.tlsReloadInterval,
  );
  // The broker owns its own in-band handshake (it speaks first, with a
  // challenge), so the route gets no ConnectionAuthenticator.
  await server.registerService(OmnyShellHubService(broker));
  await server.start();
  _server = server;
}