Matthias Nott
2026-03-24 62fc4821c4a66313c300328aa1cf19808a41e0de
lib/services/mqtt_service.dart
....@@ -56,6 +56,7 @@
5656 void Function()? onOpen;
5757 void Function()? onClose;
5858 void Function()? onReconnecting;
59
+ void Function()? onResume;
5960 void Function(String error)? onError;
6061
6162 ConnectionStatus get status => _status;
....@@ -524,10 +525,10 @@
524525 _setStatus(ConnectionStatus.reconnecting);
525526 connect();
526527 } else {
527
- // Appears connected — just let it be. The MQTT keepalive will
528
- // detect dead connections and auto-reconnect will handle it.
529
- // Don't call onOpen (it resets sessionReady and causes flicker).
530
- _mqttLog('MQTT: appears connected on resume, keeping current state');
528
+ // Appears connected — notify listener to fetch missed messages
529
+ // via catch_up. Don't call onOpen (it resets sessionReady and causes flicker).
530
+ _mqttLog('MQTT: appears connected on resume, triggering catch_up');
531
+ onResume?.call();
531532 }
532533 case AppLifecycleState.paused:
533534 break;