xHasKx / luamqtt

luamqtt - Pure-lua MQTT v3.1.1 and v5.0 client
https://xhaskx.github.io/luamqtt/
MIT License
160 stars 42 forks source link

connect event when connection fails #34

Closed Tieske closed 3 years ago

Tieske commented 3 years ago

these lines; https://github.com/xHasKx/luamqtt/blob/eacac48e31aa1a58974ef05d76687d8554a33207/mqtt/client.lua#L991:L994

send a "connect" event, when the connection actually fails. Is this intentional or a bug?

xHasKx commented 3 years ago

Yes, because CONNACK packet is received and successfully parsed. Client code have to check the .rc property

Check https://github.com/xHasKx/luamqtt/blob/master/examples/simple.lua#L17

Tieske commented 3 years ago

thx for the clarification