ServerpodClientShared constructor
ServerpodClientShared(
- String host,
- SerializationManager serializationManager, {
- dynamic securityContext,
- required AuthenticationKeyManager? authenticationKeyManager,
- required Duration? streamingConnectionTimeout,
- required Duration? connectionTimeout,
- void onFailedCall(
- MethodCallContext callContext,
- Object error,
- StackTrace stackTrace
- void onSucceededCall(
- MethodCallContext callContext
- bool? disconnectStreamsOnLostInternetConnection,
Creates a new ServerpodClientShared.
Implementation
ServerpodClientShared(
this.host,
this.serializationManager, {
dynamic securityContext,
required this.authenticationKeyManager,
required Duration? streamingConnectionTimeout,
required Duration? connectionTimeout,
this.onFailedCall,
this.onSucceededCall,
bool? disconnectStreamsOnLostInternetConnection,
}) : connectionTimeout = connectionTimeout ?? const Duration(seconds: 20),
streamingConnectionTimeout =
streamingConnectionTimeout ?? const Duration(seconds: 5) {
assert(host.endsWith('/'),
'host must end with a slash, eg: https://example.com/');
assert(host.startsWith('http://') || host.startsWith('https://'),
'host must include protocol, eg: https://example.com/');
_requestDelegate = ServerpodClientRequestDelegateImpl(
connectionTimeout: this.connectionTimeout,
serializationManager: serializationManager,
securityContext: securityContext,
);
disconnectStreamsOnLostInternetConnection ??= false;
_disconnectMethodStreamsOnLostInternetConnection =
disconnectStreamsOnLostInternetConnection;
_disconnectWebSocketStreamOnLostInternetConnection =
disconnectStreamsOnLostInternetConnection;
}