1async(3)                   Library Functions Manual                   async(3)
2
3
4

NAME

6       async - Asynchronous vs synchronous client applications
7
8       This client library supports two modes of operation. These are referred
9       to as synchronous and asynchronous modes. If your application calls
10       MQTTClient_setCallbacks(), this puts the client into asynchronous mode,
11       otherwise it operates in synchronous mode.
12
13       In synchronous mode, the client application runs on a single thread.
14       Messages are published using the MQTTClient_publish() and
15       MQTTClient_publishMessage() functions. To determine that a QoS1 or QoS2
16       (see Quality of service) message has been successfully delivered, the
17       application must call the MQTTClient_waitForCompletion() function. An
18       example showing synchronous publication is shown in Synchronous
19       publication example. Receiving messages in synchronous mode uses the
20       MQTTClient_receive() function. Client applications must call either
21       MQTTClient_receive() or MQTTClient_yield() relatively frequently in
22       order to allow processing of acknowledgements and the MQTT 'pings' that
23       keep the network connection to the server alive.
24
25       In asynchronous mode, the client application runs on several threads.
26       The main program calls functions in the client library to publish and
27       subscribe, just as for the synchronous mode. Processing of handshaking
28       and maintaining the network connection is performed in the background,
29       however. Notifications of status and message reception are provided to
30       the client application using callbacks registered with the library by
31       the call to MQTTClient_setCallbacks() (see MQTTClient_messageArrived(),
32       MQTTClient_connectionLost() and MQTTClient_deliveryComplete()). This
33       API is not thread safe however - it is not possible to call it from
34       multiple threads without synchronization. You can use the MQTTAsync API
35       for that.
36
37
38
39Paho MQTT C Client Library Thu Jul 20 2023 00:00:00                   async(3)
Impressum