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

Support large packet publishing with ESP8266 #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion Adafruit_MQTT_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,14 @@ bool Adafruit_MQTT_Client::sendPacket(uint8_t *buffer, uint16_t len) {

while (len > 0) {
if (client->connected()) {

// send 250 bytes at most at a time, can adjust this later based on Client
#ifdef ESP8266
uint16_t sendlen = len; //ESP8266's implementation can handle large packets by itself.
#else
uint16_t sendlen = len > 250 ? 250 : len;
#endif

uint16_t sendlen = len > 250 ? 250 : len;
//Serial.print("Sending: "); Serial.println(sendlen);
ret = client->write(buffer, sendlen);
DEBUG_PRINT(F("Client sendPacket returned: ")); DEBUG_PRINTLN(ret);
Expand Down