SocketClientConfig class

Constructors

SocketClientConfig({RequestSerializer serializer = const RequestSerializer(), ResponseParser parser = const ResponseParser(), bool autoReconnect = true, Duration? queryAndMutationTimeout = const Duration(seconds: 10), Duration? inactivityTimeout = const Duration(seconds: 30), Duration? delayBetweenReconnectionAttempts = const Duration(seconds: 5), dynamic initialPayload, Map<String, dynamic>? headers, WebSocketConnect? connectFn, Future<Duration?>? onConnectionLost(int? code, String? reason)?, Stream<ToggleConnectionState>? toggleConnection, Map<String, dynamic> pingMessage = const <String, dynamic>{}})
const

Properties

autoReconnect bool
Whether to reconnect to the server after detecting connection loss.
final
connectFn WebSocketConnect?
Connect or reconnect to the websocket.
final
delayBetweenReconnectionAttempts Duration?
The duration that needs to pass before trying to reconnect to the server after a connection loss. This only takes effect when autoReconnect is set to true.
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, dynamic>?
Custom header to add inside the client
final
inactivityTimeout Duration?
The duration after which the connection is considered unstable, because no keep alive message was received from the server in the given time-frame. The connection to the server will be closed. If autoReconnect is set to true, we try to reconnect to the server after the specified delayBetweenReconnectionAttempts.
final
initialPayload → dynamic
Payload to be sent with the connection_init request.
final
initOperation Future<InitOperation>
no setter
onConnectionLost Future<Duration?>? Function(int? code, String? reason)?
final
parser ResponseParser
Response parser
final
pingMessage Map<String, dynamic>
final
queryAndMutationTimeout Duration?
The duration after which a query or mutation should time out. If null, no timeout is applied, although not recommended.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serializer RequestSerializer
Serializer used to serialize request
final
toggleConnection Stream<ToggleConnectionState>?
final

Methods

connect({required Uri uri, Iterable<String>? protocols, Map<String, dynamic>? headers}) FutureOr<WebSocketChannel>
Function to define another connection without call directly the connection function
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited