hirotakaster / MQTT

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

Connecting and specifying LWT #80

Closed bwieg92 closed 5 years ago

bwieg92 commented 5 years ago

Can you provide an example of connecting and specifying a last will message? I have tried using the function bool MQTT::connect(const char *id, const char *user, const char *pass, const char* willTopic, EMQTT_QOS willQos, uint8_t willRetain, const char* willMessage, bool cleanSession, MQTT_VERSION version) however I get errors about no matching function when I attempt to compile. I have very carefully checked the data types I am passing to the function and believe I am using the correct types though.

hirotakaster commented 5 years ago

hi, here is sample, client.connect("client", "id", "password", "last/will/topic", MQTT::QOS1, 0, "will message", true);

bwieg92 commented 5 years ago

Thanks, that worked! I was missing the MQTT scope for willQos.