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 (http://www.eclipse.org/paho/files/mqttdoc/Cclient/index.html):

"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: http://modelbasedtesting.co.uk/?p=4

Ian


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.
--
cheerz,
Rajath


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/paho-dev

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


Back to the top