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
}
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 }