only check for suback if using MQTT 3.1.1 or higher

This commit is contained in:
Todd Treece 2015-10-05 11:32:10 -04:00
parent b9c9a28883
commit e70e2367b6
1 changed files with 9 additions and 6 deletions

View File

@ -125,7 +125,8 @@ int8_t Adafruit_MQTT::connect() {
if (!sendPacket(buffer, len))
return -1;
// Get SUBACK
// Check for SUBACK if using MQTT 3.1.1 or higher
if(MQTT_PROTOCOL_LEVEL > 3) {
len = readPacket(buffer, 5, CONNECT_TIMEOUT_MS);
DEBUG_PRINT(F("SUBACK:\t"));
DEBUG_PRINTBUFFER(buffer, len);
@ -134,6 +135,8 @@ int8_t Adafruit_MQTT::connect() {
}
}
}
return 0;
}