Hi iskim,
Welcome to the wolfSSL Forums.
The MQTT protocol uses a keep-alive message called a ping to sustain the communication channel between a client and the broker. During the client connect, the keep_alive_sec field is sent to broker, which uses that to determine if the client has lost it's connection. Some brokers use that value (in seconds) times 1.5 to finally disconnect the client. If your client is not sending the ping (or ping response) within the time frame negotiated, then the broker will disconnect the client.
> - Under what circumstances does WolfMQTT trigger a NETWORK error?
A network timeout can occur when the client attempts to read or write data to the network, but the operation takes too long. This is configurable with the timeout_ms parameter when calling MqttClient_NetConnect.
> - Are there any specific configurations or common pitfalls that I should look into to prevent this kind of disconnection?
A network error might not even be on client side. The application should handle network problems gracefully and allow reconnection attempts.
Could you tell us more about your MQTT project and your location for our support records? Feel free to email us at support@wolfssl.com for a more private conversation.
Kind regards,
Eric - wolfSSL Support