hirotakaster / MQTT

MQTT for Photon, Spark Core
Other
216 stars 118 forks source link

Clean session not implemented correctly #62

Closed robynjayqueerie closed 7 years ago

robynjayqueerie commented 7 years ago

I traced though the implementation of the clean session. I don't believe it was implemented correctly By default the clean session is set by the time you get to line 132 of mqtt.cpp, you need to clear it to get a persistent session if the clean session flag is false uint8_t v; if (willTopic) { v = 0x06|(willQos<<3)|(willRetain<<5); // the 0x06 sets the clean session flag here } else { v = 0x02; // clean session flag }

        if (!cleanSession) {    // need to reset the flag which is already set
          v = v & 0xfd; // clear the clean session flag RH
        }
hirotakaster commented 7 years ago

hi @robynjayqueerie thank you. update to 0.4.20