256dpi / arduino-mqtt

MQTT library for Arduino
MIT License
1.01k stars 230 forks source link

MQTT SSL connection issue with QoS1 and QoS2 messages #304

Open haisul opened 1 year ago

haisul commented 1 year ago

Hi I use SSL to connect to a broker. When I publish a QoS1 or QoS2 message, there is a high probability that the MQTT connection will be disconnected. When I print the lastError, it shows LWMQTT_NETWORK_FAILED_READ. However, I have confirmed that my Wi-Fi is connected and functioning properly; only the MQTT connection is disconnected

hmueller01 commented 6 months ago

Are you sure that you do not have a publish / subscribe / unsubscribe in onMessage callback? I had very strange behavior by that (LWMQTT_NETWORK_FAILED_READ = -5 and LWMQTT_MISSING_OR_WRONG_PACKET = -9) ... After eliminating that it works good using TLS / BearSSL and QOS1 and QOS2 messages.