yosssi / gmq

Pure Go MQTT Client
MIT License
346 stars 46 forks source link

ErrInvalidPacketID on reconnect #14

Open dustin opened 5 years ago

dustin commented 5 years ago

I've got an application that I'd written using gmq that consistently failed to connect to my MQTT server. I had been subscribed to a couple of topics (wildcarded) at QoS2 and was not using clean sessions. Apparently I lost a connection with some messages in flight and on reconnect, the broker was attempting to redeliver lost messages, confusing the client.

I was able to make my application work again by dropping to QoS0 and getting a clean session (probably only the latter mattered), but I didn't notice the loss for several hours, so I can't make a reliable app currently with QoS > 0 and reusing sessions.