paho.mqtt.c
paho.mqtt.c copied to clipboard
MQTTClient_publish can not return
Hi, I am calling MQTTClient_publish from inside a messageArrived callback. Sometimes the MQTTClient_publish blocks and cannot return. Is this a normal phenomenon? Should I not call MQTTClient_publish in messageArrived callback?
If the locking problem is normal, are there any good suggestions to avoid it?
Thanks!
You mustn't make any MQTTClient API calls in any callback, except for Connect in the ConnectionLost callback. If you want to do this sort of thing, you can use the MQTTAsync API, which does allow it.
I think this is answered.