256dpi / arduino-mqtt

MQTT library for Arduino
MIT License
1.01k stars 232 forks source link

setWill payload is just 52Bytes??? #259

Closed seksity closed 2 years ago

seksity commented 3 years ago

I using ESP32 Arduino project on PlatformIO to publish MQTT message 100-Bytes successfully But whenI try to use Will message withpayload about 100 bytes it unsuccessful to publish message.

By using setWill() with example payload as below:-

0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

It 's 100-Bytes, but unsuccessfully to publish above message. BUT, when I reduce payload size and it can publish just 52-Bytes, and If more than that mqttClient struggle in while loop mqttClient try to connect to MQTT Broker -- as source code below.

mqttClient.begin(MQTT_SERVER, MQTT_PORT, wifiClient);
mqttClient.setKeepAlive(MQTT_KEEPALIVE);
mqttClient.setWill(MQTT_WILL_TOPIC, "012345678901234567890123456789012345678901234567890123456789", MQTT_WILL_RETAIN, MQTT_WILL_QOS);
mqttClient.onMessage(messageReceived);
while (!mqttClient.connect(IMEI, SERIAL_NO, MQTT_BROKER_PASSWORD)) {
     Serial.print(".");
     delay(1000);
}

How many a Will message can publish payload size? Does it have limit?