WebSocketConfig constructor

const WebSocketConfig({
  1. required String url,
  2. List<String>? protocols,
  3. Map<String, String>? headers,
  4. Duration? pingInterval,
  5. Duration connectionTimeout = const Duration(seconds: 10),
  6. Duration reconnectDelay = const Duration(seconds: 5),
  7. int maxReconnectAttempts = 3,
  8. bool autoReconnect = true,
  9. bool enableLogging = false,
  10. bool enableHeartbeat = true,
  11. Duration heartbeatInterval = const Duration(seconds: 30),
  12. Duration heartbeatTimeout = const Duration(seconds: 10),
  13. String heartbeatMessage = 'ping',
  14. String? expectedPongMessage,
  15. int maxMissedHeartbeats = 3,
  16. bool useExponentialBackoff = true,
  17. Duration maxReconnectDelay = const Duration(minutes: 5),
  18. double backoffMultiplier = 2.0,
  19. 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,
});