Hi,
I have observed that when the device is setup and connected to the broker there is no issue that is observed. But when the AP to which the device is connected to looses internet access the device gets stuck after MQTTClient_publish(....) API is called.
The general observation is that when the device is connected to the AP and the internet access is turned off, there is an interval (I guess TCP Keep Alive) which detects that the internet is not connected and then triggers the respective MQTT callback. But within this period if I publish any message to the broker using MQTTClient_publish the device does not return from this funtion.
In order to fix this issue, after reading a little I came across the MQTT Client parameter blockingSend which was set as true. When I set this to false and recreated the same condition the issue seemed to have been solved.
There are two questions that I had relating to this:
1. What all are the affects caused by setting the blockingSend parameter to false??
2. When set to false the MQTTClient_publish(....) function does not return any error. The return value observed is 0. Is there a way to identify this situation??
Regards,
Darpan.
typedef struct MQTTClient_Params{ /** client id */ char *clientId;
/** * Operate in MQTT 3.1 mode: * - false: 3.1.1 (default) * - true - 3.1 */ bool mqttMode31;
bool blockingSend; MQTTClient_ConnParams *connParams; /**< pointer to connection params */
} MQTTClient_Params;