diff --git a/Sming/SmingCore/Network/MqttClient.cpp b/Sming/SmingCore/Network/MqttClient.cpp index 33c6e02902..0c5d19538f 100644 --- a/Sming/SmingCore/Network/MqttClient.cpp +++ b/Sming/SmingCore/Network/MqttClient.cpp @@ -77,6 +77,10 @@ bool MqttClient::setWill(const String& topic, const String& message, int QoS, bo bool MqttClient::connect(const URL& url, const String& clientName, uint32_t sslOptions) { this->url = url; + if (not (url.Protocol == "mqtt" || url.Protocol == "mqtts")) { + debug_e("Only mqtt and mqtts protocols are allowed"); + return false; + } waitingSize = 0; posHeader = 0; current = NULL; diff --git a/Sming/SmingCore/Network/MqttClient.h b/Sming/SmingCore/Network/MqttClient.h index d247c3033e..d2985842ee 100644 --- a/Sming/SmingCore/Network/MqttClient.h +++ b/Sming/SmingCore/Network/MqttClient.h @@ -55,7 +55,7 @@ class MqttClient: protected TcpClient bool setWill(const String& topic, const String& message, int QoS, bool retained = false); /** @brief Connect to a MQTT server - * @param url, in the form "mttqs://user:password@server:port" + * @param url, in the form "mqtt://user:password@server:port" or "mqtts://user:password@server:port" * @param client name */ bool connect(const URL& url, const String& uniqueClientName, uint32_t sslOptions = 0);