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,
- int maxMissedHeartbeats = 3,
- bool useExponentialBackoff = true,
- Duration maxReconnectDelay = const Duration(minutes: 5),
- double backoffMultiplier = 2.0,
- HttpClient? httpClient,
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.maxMissedHeartbeats = 3,
this.useExponentialBackoff = true,
this.maxReconnectDelay = const Duration(minutes: 5),
this.backoffMultiplier = 2.0,
this.httpClient,
});