| .. | .. |
|---|
| 397 | 397 | Future<bool> _tryConnect(String host, String clientId, {int timeout = 5000}) async { |
|---|
| 398 | 398 | try { |
|---|
| 399 | 399 | final client = MqttServerClient.withPort(host, clientId, config.port); |
|---|
| 400 | | - client.keepAlivePeriod = 30; |
|---|
| 400 | + client.keepAlivePeriod = 120; // 2 min — iOS throttles bg network, short keepalive causes drops |
|---|
| 401 | 401 | client.autoReconnect = false; // Don't auto-reconnect during trial — enable after success |
|---|
| 402 | 402 | client.connectTimeoutPeriod = timeout; |
|---|
| 403 | 403 | // client.maxConnectionAttempts is final — can't set it |
|---|