eclipse / paho.mqtt.android

MQTT Android
Other
2.88k stars 862 forks source link

Receive messages on a non-UI thread #459

Open HawkiesZA opened 3 years ago

HawkiesZA commented 3 years ago

When setting a new callback, messages are received on the UI thread. This completely locks up the UI if there are lots of messages being received. This has been discussed before here: https://github.com/eclipse/paho.mqtt.android/issues/207, but it seems that the solution was never implemented.

Please make sure that the following boxes are checked before submitting your Pull Request, thank you!

tabilzad commented 2 years ago

LocalBroadcastManager is a lot more efficient than global broadcasting through context. With the latter if the massage payload is too big - it will throw a TransactionTooLargeException.

HawkiesZA commented 2 years ago

While that may be true, LocalBroadcastManager doesn't appear to have a way to address the problem of locking up the UI thread as explained above. I think this may just be a quick fix under the current situation, but actually we should be looking at a different pattern rather than BroadcastManagers, considering that LocalBroadcastManager has been deprecated as well.

ishdemon commented 11 months ago

Use HiveMqtt instead of paho..its better maintained.