diff --git a/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.cpp b/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.cpp index 68cc2dafa285..0748fdc4ae8f 100644 --- a/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.cpp +++ b/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.cpp @@ -610,11 +610,13 @@ boolean PubSubClient::unsubscribe(const char* topic) { return false; } -void PubSubClient::disconnect() { +void PubSubClient::disconnect(bool disconnect_package) { buffer[0] = MQTTDISCONNECT; buffer[1] = 0; if (_client != nullptr) { - _client->write(buffer,2); + if (disconnect_package) { + _client->write(buffer,2); + } _client->flush(); _client->stop(); } diff --git a/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.h b/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.h index aa2080ed1e18..593077e8c33e 100644 --- a/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.h +++ b/lib/PubSubClient-EspEasy-2.7.12/src/PubSubClient.h @@ -141,7 +141,7 @@ class PubSubClient : public Print { boolean connect(const char* id, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage); boolean connect(const char* id, const char* user, const char* pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage); boolean connect(const char* id, const char* user, const char* pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage, boolean cleanSession); - void disconnect(); + void disconnect(bool disconnect_package = false); boolean publish(const char* topic, const char* payload); boolean publish(const char* topic, const char* payload, boolean retained); boolean publish(const char* topic, const uint8_t * payload, unsigned int plength);