Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Why connect() method has been designed to work only synchronously?

Hello everyone,

All the network operations like sending/receiving messages or ping of Eclipse Paho MQTT client library are designed to work asynchronously. One can even use MqttDeliveryToken.waitForCompletion() method if he wants to work synchronously, a huge plus. But unfortunately the  connect() method works only synchronously, it waits and waits until timeout occurs. That causes additional trouble if you want to use this library on Android, you have to maintain additional thread to connect, otherwise on UI thread there is a chance to face ANR (application not responding) error.

Is there any specific reason behind this design? Or, may I request additional callback methods to handle login result in future releases, so that I can work in asynchronous manner?

Regards,
Mehdi



Back to the top