| .. | .. |
|---|
| 56 | 56 | void Function()? onOpen; |
|---|
| 57 | 57 | void Function()? onClose; |
|---|
| 58 | 58 | void Function()? onReconnecting; |
|---|
| 59 | + void Function()? onResume; |
|---|
| 59 | 60 | void Function(String error)? onError; |
|---|
| 60 | 61 | |
|---|
| 61 | 62 | ConnectionStatus get status => _status; |
|---|
| .. | .. |
|---|
| 524 | 525 | _setStatus(ConnectionStatus.reconnecting); |
|---|
| 525 | 526 | connect(); |
|---|
| 526 | 527 | } 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(); |
|---|
| 531 | 532 | } |
|---|
| 532 | 533 | case AppLifecycleState.paused: |
|---|
| 533 | 534 | break; |
|---|