[0.76] WebSocket (MQTT) connection does not emit ‘offline’ event when the app goes to the background #49243
Labels
Needs: Author Feedback
Needs: Repro
This issue could be improved with a clear list of steps to reproduce the issue.
Newer Patch Available
Description
In React Native 0.73, WebSocket-based MQTT connections worked correctly in the background.
When the app moved to the background, the connection eventually dropped, and the offline event was emitted.
However, after updating to React Native 0.76, the offline event is not emitted, and the MQTT connection is not automatically closed when the app moves to the background.
Possible Causes:
• The behavior of setImmediate has changed, affecting WebSocket execution in the background.
• The introduction of queueReactNativeMicrotask (starting from RN 0.74) may have affected this behavior.
Steps to reproduce
React Native Version
0.76.0
Affected Platforms
Runtime - Android
Output of
npx react-native info
Stacktrace or Logs
Reproducer
none
Screenshots and Videos
The text was updated successfully, but these errors were encountered: