refusal property

String? get refusal

Whether a new link would be refused, and if so why.

Null when accept would take it. A server can ask before upgrading, so a closed or full hub never allocates a socket at all.

Implementation

String? get refusal {
  if (_status == HubSessionStatus.closed) return 'Session closed';
  if (_pending.length + _connections.length >= limits.maxConnections) {
    return 'Hub at capacity';
  }
  return null;
}