From 489419f3b133c4725d1ffdf5fb320898a55e9544 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Mon, 06 Apr 2026 20:16:38 +0200
Subject: [PATCH] fix: increase MQTT keepalive to 120s to prevent iOS network throttle drops
---
lib/services/mqtt_service.dart | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/services/mqtt_service.dart b/lib/services/mqtt_service.dart
index 018fa55..0c0502e 100644
--- a/lib/services/mqtt_service.dart
+++ b/lib/services/mqtt_service.dart
@@ -397,7 +397,7 @@
Future<bool> _tryConnect(String host, String clientId, {int timeout = 5000}) async {
try {
final client = MqttServerClient.withPort(host, clientId, config.port);
- client.keepAlivePeriod = 30;
+ client.keepAlivePeriod = 120; // 2 min — iOS throttles bg network, short keepalive causes drops
client.autoReconnect = false; // Don't auto-reconnect during trial — enable after success
client.connectTimeoutPeriod = timeout;
// client.maxConnectionAttempts is final — can't set it
--
Gitblit v1.3.1