RoomClient constructor

RoomClient({
  1. required ProtocolFactory protocolFactory,
  2. Duration? reconnectTimeout,
  3. Duration reconnectRetryBaseDelay = const Duration(milliseconds: 500),
  4. Duration reconnectRetryMaxDelay = const Duration(seconds: 30),
  5. OAuthTokenRequestHandler? oauthTokenRequestHandler,
  6. SecretRequestHandler? secretRequestHandler,
})

Implementation

RoomClient({
  required ProtocolFactory protocolFactory,
  Duration? reconnectTimeout,
  Duration reconnectRetryBaseDelay = const Duration(milliseconds: 500),
  Duration reconnectRetryMaxDelay = const Duration(seconds: 30),
  OAuthTokenRequestHandler? oauthTokenRequestHandler,
  SecretRequestHandler? secretRequestHandler,
}) : _protocolFactory = protocolFactory,
     _reconnectTimeout = reconnectTimeout,
     _reconnectRetryBaseDelay = reconnectRetryBaseDelay,
     _reconnectRetryMaxDelay = reconnectRetryMaxDelay {
  if (reconnectTimeout != null && reconnectTimeout.isNegative) {
    throw ArgumentError.value(reconnectTimeout, 'reconnectTimeout', 'must be null or non-negative');
  }
  if (reconnectRetryBaseDelay <= Duration.zero) {
    throw ArgumentError.value(reconnectRetryBaseDelay, 'reconnectRetryBaseDelay', 'must be positive');
  }
  if (reconnectRetryMaxDelay <= Duration.zero) {
    throw ArgumentError.value(reconnectRetryMaxDelay, 'reconnectRetryMaxDelay', 'must be positive');
  }
  _protocolInstance = _protocolFactory();
  unawaited(_ready.future.catchError((Object _) {}));
  protocol = RoomProtocolProxy(room: this);
  protocol.addHandler('__response__', _handleResponse);
  protocol.addHandler('connected', _handleParticipant);
  protocol.addHandler('room_ready', _handleRoomReady);
  protocol.addHandler('room.status', _handleRoomStatus);
  protocol.addHandler('room.tool_call_response_chunk', _handleToolCallResponseChunk);
  sync = SyncClient(room: this);
  storage = StorageClient(room: this);
  developer = DeveloperClient(room: this);
  messaging = MessagingClient(room: this);
  agents = AgentsClient(room: this);
  queues = QueuesClient(room: this);
  datasets = DatasetsClient(room: this);
  memory = MemoryClient(room: this);
  containers = ContainersClient(room: this);
  services = ServicesClient(room: this);
  secrets = SecretsClient(room: this, oauthTokenRequestHandler: oauthTokenRequestHandler, secretRequestHandler: secretRequestHandler);
}