arduino-libraries / ArduinoMqttClient

ArduinoMqttClient Library for Arduino
GNU Lesser General Public License v2.1
186 stars 73 forks source link

QoS2 PUBREC causes connection drop #64

Open oaken-source opened 2 years ago

oaken-source commented 2 years ago

I'm using ArduinoMqttClient together with a mosquitto broker, and sometimes when sending a QoS2 message, the connection will drop silently. (It seems this always happens on the second QoS2 message, but I'm not sure)

This is the output of mosquitto at the time of the connection drop:

1643105742: Received PUBLISH from mqtt:topic:01045ea9a2:a24a82972a (d0, q2, r0,
m2, 'mqtt:topic:01045ea9a2:a24a82972a/Notify', ... (29 bytes))
1643105742: Sending PUBREC to mqtt:topic:01045ea9a2:a24a82972a (m2, rc0)
1643105742: Received PINGREQ from mqtt:topic:01045ea9a2:a24a82972a
1643105742: Sending PINGRESP to mqtt:topic:01045ea9a2:a24a82972a
1643105742: Received DISCONNECT from mqtt:topic:01045ea9a2:a24a82972a
1643105742: Client mqtt:topic:01045ea9a2:a24a82972a disconnected.

It seems like ArduinoMqttClient responds to PUBREC with a PINGREQ instead of the correct message. How could this happen?