connect method
Implementation
Future<void> connect() async {
if (_disposed) throw StateError('WebSocketClient has been disposed');
_log('Attempting to connect to ${config.url}');
try {
await _adapter.connect();
_log('Successfully connected to ${config.url}');
_reconnectionManager.reset();
if (config.enableHeartbeat) _heartbeatManager.start();
_drainQueue();
_publishStats();
} catch (error) {
_log('Failed to connect: $error');
if (config.autoReconnect) _reconnectionManager.startReconnection();
rethrow;
}
}