Skip to content

Commit

Permalink
Increased MQTT message buffer. (sidoh#614)
Browse files Browse the repository at this point in the history
With a smaller buffer it's possible that too long last will message will prevent MQTT client from connecting to the MQTT broker.
  • Loading branch information
mlewand authored Apr 11, 2020
1 parent 50e91bf commit fd7228c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/MQTT/MqttClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ bool MqttClient::connect() {
sprintf_P(nameBuffer, PSTR("milight-hub-%u"), ESP.getChipId());

#ifdef MQTT_DEBUG
Serial.println(F("MqttClient - connecting"));
Serial.println(F("MqttClient - connecting using name"));
Serial.println(nameBuffer);
#endif

if (settings.mqttUsername.length() > 0 && settings.mqttClientStatusTopic.length() > 0) {
Expand Down Expand Up @@ -112,7 +113,8 @@ void MqttClient::reconnect() {
Serial.println(F("MqttClient - Successfully connected to MQTT server"));
#endif
} else {
Serial.println(F("ERROR: Failed to connect to MQTT server"));
Serial.print(F("ERROR: Failed to connect to MQTT server rc="));
Serial.println(mqttClient.state());
}
}

Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ build_flags =
!python3 .get_version.py
# For compatibility with WebSockets 2.1.4 and v2.4 of the Arduino SDK
-D USING_AXTLS
-D MQTT_MAX_PACKET_SIZE=250
-D MQTT_MAX_PACKET_SIZE=360
-D HTTP_UPLOAD_BUFLEN=128
-D FIRMWARE_NAME=milight-hub
-D RICH_HTTP_REQUEST_BUFFER_SIZE=2048
Expand Down

0 comments on commit fd7228c

Please sign in to comment.