paho.mqtt.c icon indicating copy to clipboard operation
paho.mqtt.c copied to clipboard

MQTTClient_publish can not return

Open levin-go opened this issue 2 years ago • 1 comments

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!

levin-go avatar Aug 26 '22 05:08 levin-go

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.

icraggs avatar Sep 21 '22 09:09 icraggs

I think this is answered.

icraggs avatar Nov 25 '22 15:11 icraggs