Topic: -7 Timeout error on Publish Message


I have some troubles with a Timeout Error (-7) after the MqttClient_Publish call. Most of times the messages are correctly sent despite the MqttClient_Publish function returns Timeout. But sometimes the messages are not received from broker after this error.

Please can you give me some additional info about this error code returned by MqttClient_Publish ?


Re: -7 Timeout error on Publish Message

Hello Davide,

Thanks for joining the wolfSSL forums. The timeout error simply indicates that the client has been inactive long enough that it needs to send a ping to the broker to maintain the connection. It is an informative error.

Could you tell us more about your project and goals with wolfMQTT?

Eric @ wolfSSL Support

3 (edited by davide.diste18 2022-07-04 00:57:47)

Re: -7 Timeout error on Publish Message

Hello Eric,

Thanks for reply.
I have a wolfMQTT client on PikeOS RT O.S. that communicates with an external Windows  MQTT Client.
Also the Borker is installed on Windows Host. The ethernet connection is Point-2-Point . Windows Client is the master of communication, it send commands on specific Topics and wolffMQTT client publish responses on other topics. Windows client send also periodic requests (every 3 seconds ) and WolfMQTT topic must response also to this requests.

On WolfMQTT sided  I have a thread that manages MQTT Ping and the WaitMessages. When a new message is received it is sent on a queue and there is another thread that read from this queue and publishes  the relative responses.

Every time WolffMQTT client send a response message it returns -7 (Timeout) and after about 5 minutes of communication wolffMQtt Client doesn't receive new MQTT messages.

Is there an internal buffer on WolffMQTT client that could cause the issue or can you suggest me another possible cause?

Thanks in advance for the support.



Re: -7 Timeout error on Publish Message

Hi Davide,

This is a bit more complex problem than what should be supported in a forum post. Could you please open a formal support ticket by emailing