diff --git a/src/MqttClient.cpp b/src/MqttClient.cpp index 9dc0f02..66c71e6 100644 --- a/src/MqttClient.cpp +++ b/src/MqttClient.cpp @@ -249,6 +249,10 @@ int MqttClient::getConnectionFailedCount(void) { return connectionFailedCount; } #ifdef ESP8266 bool MqttClient::connect(String id) { + if (isBegin == false) { + return false; + } + if (this->uri.isEmpty()) { return false; } @@ -264,6 +268,9 @@ bool MqttClient::connect(String id) { return CLIENT()->connect(id.c_str(), user.c_str(), password.c_str()); } void MqttClient::handle(void) { + if (isBegin == false) { + return; + } CLIENT()->loop(); } #endif