1callbacks(3) Library Functions Manual callbacks(3)
2
3
4
6 callbacks - Callbacks
7
8 You must not call a function from this API from within a callback
9 otherwise a deadlock might result. The only exception to this is the
10 ability to call connect within the connection lost callback, to allow a
11 reconnect.
12
13 When using MQTT 5.0, you can also call connect from within the
14 disconnected callback, which is invoked when the MQTT server sends a
15 disconnect packet. This server behaviour is allowed in MQTT 5.0, but
16 not in MQTT 3.1.1, so the disconnected callback will never be invoked
17 if you use MQTT 3.1.1.
18
19 In particular, you must make a publish call within the message arrived
20 callback. These restrictions are all lifted in the MQTTAsync API.
21
22 If no callbacks are assigned, this will include the message arrived
23 callback. This could be done if the application is a pure publisher,
24 and does not subscribe to any topics. If however messages are received,
25 and no message arrived callback is set, or receive not called, then
26 those messages will accumulate and take up memory, as there is no place
27 for them to be delivered. It is up to the application to protect
28 against this situation.
29
30
31
32Paho MQTT C Client Library Thu Jan 19 2023 callbacks(3)