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. RegExp? expectedPongMessagePattern,
  16. int maxMissedHeartbeats = 3,
  17. bool useExponentialBackoff = true,
  18. Duration maxReconnectDelay = const Duration(minutes: 5),
  19. double backoffMultiplier = 2.0,
  20. Object? httpClient,
  21. bool enableMessageQueue = false,
  22. int maxQueueSize = 100,
  23. Duration? messageQueueTimeout,
  24. bool enableAck = false,
  25. Duration ackTimeout = const Duration(seconds: 30),
  26. 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,
});