Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/mqtt protocol #1410

Merged
merged 3 commits into from
Jul 9, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Sming/SmingCore/Network/MqttClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("Invalid protocol");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frankdownunder Maybe the error message should be a bit more descriptive and explain that only mqtt and mqtts protocols are allowed.

return false;
}
waitingSize = 0;
posHeader = 0;
current = NULL;
Expand Down
2 changes: 1 addition & 1 deletion Sming/SmingCore/Network/MqttClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down