hubInfo method

Future<HubInfo> hubInfo()

Asks the Hub to describe itself: version, platform, uptime and activity.

Completes with HubTooOldException without a round trip when the Hub is older than 1.66.0 — it would silently drop the request. Every failure arrives through the returned future, never as a synchronous throw.

Implementation

Future<HubInfo> hubInfo() async {
  _ensureConnected();
  if (_hubVersion == null) {
    throw const HubTooOldException(
      'The Hub is older than 1.66.0 and cannot describe itself; '
      'upgrade it to see hub info.',
    );
  }
  final id = newId();
  final completer = Completer<HubInfo>();
  _pendingHubInfos[id] = completer;
  _connection!.send(ControlFrame(HubInfoRequest(requestId: id)));
  return _rpcTimeout(completer.future, () => _pendingHubInfos.remove(id));
}