Common options for VM and JS platforms:
The connectionRetryInterval argument is specifying the backoff full jitter strategy for reconnecting. Tweaks for reconnect backoff algorithm (min delay, max delay) If not specified, the reconnecting will be disabled.
The protocols argument is specifying the subprotocols the client is willing to speak.
The timeout argument is specifying the maximum time to wait for the connection to be established.
The afterConnect argument is specifying the callback function to be called after the connection is established, but before the client allow to send user messages. Good place to send authentication data, subscribe to channels, or send any other initial data.
The interceptors argument is specifying the interceptors for WebSocket messages.
Other arguments are platform dependent.
- Annotations
-
- @immutable
Constructors
-
WebSocketOptions({ConnectionRetryInterval? connectionRetryInterval, Iterable<
String> ? protocols, Duration? timeout, FutureOr<void> afterConnect(IWebSocketClient client)?, Iterable<WSInterceptor> ? interceptors}) - Common options for VM and JS platforms:
-
WebSocketOptions.common({ConnectionRetryInterval? connectionRetryInterval, Iterable<
String> ? protocols, Duration? timeout, FutureOr<void> afterConnect(IWebSocketClient)?, Iterable<WSInterceptor> ? interceptors}) -
factory
-
WebSocketOptions.js({ConnectionRetryInterval? connectionRetryInterval, Iterable<
String> ? protocols, Duration? timeout, bool? useBlobForBinary, FutureOr<void> afterConnect(IWebSocketClient)?, Iterable<WSInterceptor> ? interceptors}) -
Options for JS (Browser) platform.
Do not use this class at the VM platform.
factory
- WebSocketOptions.selector({required WebSocketOptions vm(), required WebSocketOptions js()})
-
Construct options for VM or JS platform depending on the current platform.
factory
-
WebSocketOptions.vm({ConnectionRetryInterval? connectionRetryInterval, Iterable<
String> ? protocols, Map<String, Object?> ? headers, Object? compression, Object? customClient, String? userAgent, Duration? timeout, FutureOr<void> afterConnect(IWebSocketClient)?, Iterable<WSInterceptor> ? interceptors}) -
Options for VM (Mobile, Desktop, Server, Console) platform.
Do not use this class at the web platform.
factory
Properties
-
afterConnect
→ (FutureOr<
void> Function(IWebSocketClient client)?) -
Callback function to be called after the connection is established,
but before the client allow to send user messages.
final
- connectionRetryInterval → ConnectionRetryInterval?
-
Backoff strategy for reconnecting.
Tweaks for reconnect backoff algorithm (min delay, max delay)
If not specified, the reconnecting will be disabled.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
interceptors
→ List<
WSInterceptor> ? -
Interceptors for WebSocket messages.
final
-
protocols
→ Set<
String> ? -
Web Socket protocols.
If not specified, the protocols will not be used.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeout → Duration
-
Maximum time to wait for the connection to be established.
If not specified, the timeout will be 30 seconds.
final
Methods
-
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