WebSocketConfig class
Configuration class for WebSocket connections
Constructors
-
WebSocketConfig({required String url, List<
String> ? protocols, Map<String, String> ? headers, Duration? pingInterval, Duration connectionTimeout = const Duration(seconds: 10), Duration reconnectDelay = const Duration(seconds: 5), int maxReconnectAttempts = 3, bool autoReconnect = true, bool enableLogging = false, bool enableHeartbeat = true, Duration heartbeatInterval = const Duration(seconds: 30), Duration heartbeatTimeout = const Duration(seconds: 10), String heartbeatMessage = 'ping', String? expectedPongMessage, RegExp? expectedPongMessagePattern, int maxMissedHeartbeats = 3, bool useExponentialBackoff = true, Duration maxReconnectDelay = const Duration(minutes: 5), double backoffMultiplier = 2.0, Object? httpClient, bool enableMessageQueue = false, int maxQueueSize = 100, Duration? messageQueueTimeout, bool enableAck = false, Duration ackTimeout = const Duration(seconds: 30), int maxAckRetries = 3}) -
const
Properties
- ackTimeout → Duration
-
How long to wait for an ACK before retrying.
final
- autoReconnect → bool
-
final
- backoffMultiplier → double
-
final
- connectionTimeout → Duration
-
final
- enableAck → bool
-
Require server acknowledgement for sent messages.
final
- enableHeartbeat → bool
-
final
- enableLogging → bool
-
final
- enableMessageQueue → bool
-
Buffer outgoing messages when disconnected and flush on reconnect.
final
- expectedPongMessage → String?
-
final
- expectedPongMessagePattern → RegExp?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> ? -
final
- heartbeatInterval → Duration
-
final
- heartbeatMessage → String
-
final
- heartbeatTimeout → Duration
-
final
- httpClient → Object?
-
Optional custom HTTP client for native platforms only.
Pass a
dart:ioHttpClient instance; ignored on web/WASM.final - maxAckRetries → int
-
Maximum retry attempts before the send Future fails.
final
- maxMissedHeartbeats → int
-
final
- maxQueueSize → int
-
Maximum number of messages to buffer. 0 = unlimited.
final
- maxReconnectAttempts → int
-
final
- maxReconnectDelay → Duration
-
final
- messageQueueTimeout → Duration?
-
How long a queued message remains valid.
null= no expiry.final - pingInterval → Duration?
-
final
-
protocols
→ List<
String> ? -
final
- reconnectDelay → Duration
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- url → String
-
final
- useExponentialBackoff → bool
-
final
Methods
-
copyWith(
{String? url, List< String> ? protocols, Map<String, String> ? headers, Duration? pingInterval, Duration? connectionTimeout, Duration? reconnectDelay, int? maxReconnectAttempts, bool? autoReconnect, bool? enableLogging, bool? enableHeartbeat, Duration? heartbeatInterval, Duration? heartbeatTimeout, String? heartbeatMessage, String? expectedPongMessage, RegExp? expectedPongMessagePattern, int? maxMissedHeartbeats, bool? useExponentialBackoff, Duration? maxReconnectDelay, double? backoffMultiplier, Object? httpClient, bool? enableMessageQueue, int? maxQueueSize, Duration? messageQueueTimeout, bool? enableAck, Duration? ackTimeout, int? maxAckRetries}) → WebSocketConfig -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited