WebSocketConfig constructor
const
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,
Implementation
const WebSocketConfig({
required this.url,
this.protocols,
this.headers,
this.pingInterval,
this.connectionTimeout = const Duration(seconds: 10),
this.reconnectDelay = const Duration(seconds: 5),
this.maxReconnectAttempts = 3,
this.autoReconnect = true,
this.enableLogging = false,
// Heartbeat defaults
this.enableHeartbeat = true,
this.heartbeatInterval = const Duration(seconds: 30),
this.heartbeatTimeout = const Duration(seconds: 10),
this.heartbeatMessage = 'ping',
this.expectedPongMessage,
this.expectedPongMessagePattern,
this.maxMissedHeartbeats = 3,
this.useExponentialBackoff = true,
this.maxReconnectDelay = const Duration(minutes: 5),
this.backoffMultiplier = 2.0,
this.httpClient,
// Message queue defaults
this.enableMessageQueue = false,
this.maxQueueSize = 100,
this.messageQueueTimeout,
// ACK defaults
this.enableAck = false,
this.ackTimeout = const Duration(seconds: 30),
this.maxAckRetries = 3,
});