Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] MQTTClient or MQTTAsync ?

From the MQTTClient API documentation (

"These pages describe the original more synchronous API which might be considered easier to use. Some of the calls will block. For the new totally asynchronous API where no calls block, which is especially suitable for use in windowed environments, see the MQTT C Client Asynchronous API Documentation."

So the difference is that no calls block in the MQTTAsync API - all information about whether an API call worked is returned in callbacks.  This makes it a little harder to program, but essential for some environments such as iOS.

A longer description of the differences is here:


On 04/08/2014 07:11 AM, rajath ramesh wrote:
Hi ,

I was going through samples for asynchronous publication and came across below 2 examples

As per reading adding setCallbacks will make the client asynchronous

2. MQTTAsync - (attaching file - ) I does almost the same except 
while(deliveredtoken != token); ( as in 1 )

Difference between 1 and 2 is waiting for the delivery of the published messaged only ?
I wanted to have clear understanding how 1 and 2 are different.
What are advantages of using MQTTAsync instead of MQTTClient (using setCallbacks) for asynchronous publication.

paho-dev mailing list

Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Committer on Paho, Mosquitto

Back to the top