Matthias Nott
9 days ago 489419f3b133c4725d1ffdf5fb320898a55e9544
lib/services/mqtt_service.dart
....@@ -397,7 +397,7 @@
397397 Future<bool> _tryConnect(String host, String clientId, {int timeout = 5000}) async {
398398 try {
399399 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
401401 client.autoReconnect = false; // Don't auto-reconnect during trial — enable after success
402402 client.connectTimeoutPeriod = timeout;
403403 // client.maxConnectionAttempts is final — can't set it