Hi Erel,
I’ve been debugging MQTT Publish2 behavior in B4R on ESP8266 and found a silent payload size limit.
Using Publish2(Topic As String, Payload As String, Retained As Boolean):
- Short payloads work reliably
- When the combined size of topic + payload exceeds ~85–90 bytes, the message is silently dropped
- No error is returned, and nothing reaches the broker (confirmed with MQTT Explorer)
This happens consistently with retained messages and JSON payloads.
Example:
Topic:
homeassistant/sensor/ph_1/ph/config (35 bytes)
Payload (works):
"{""name"":""pH meter"",""state_topic"":""Esp/ph"",""unique_id"":""ph_1_abcdefghi123456789abc_ph""}"
Payload (does NOT work):
"{""name"":""pH meter"",""state_topic"":""Esp/ph"",""unique_id"":""ph_1_abcdefghi123456789abcde_ph""}"
I verified this by adding/removing characters one by one.
It seems there is a fixed internal buffer limit in the MQTT client for ESP8266.
Questions:
1. Is there a documented payload/topic size limit for Publish2 on ESP8266?
2. Is this a known limitation or a bug?
3. Is there a recommended workaround (larger buffer, Publish instead of Publish2, etc.)?
Thanks,
Mania
I’ve been debugging MQTT Publish2 behavior in B4R on ESP8266 and found a silent payload size limit.
Using Publish2(Topic As String, Payload As String, Retained As Boolean):
- Short payloads work reliably
- When the combined size of topic + payload exceeds ~85–90 bytes, the message is silently dropped
- No error is returned, and nothing reaches the broker (confirmed with MQTT Explorer)
This happens consistently with retained messages and JSON payloads.
Example:
Topic:
homeassistant/sensor/ph_1/ph/config (35 bytes)
Payload (works):
"{""name"":""pH meter"",""state_topic"":""Esp/ph"",""unique_id"":""ph_1_abcdefghi123456789abc_ph""}"
Payload (does NOT work):
"{""name"":""pH meter"",""state_topic"":""Esp/ph"",""unique_id"":""ph_1_abcdefghi123456789abcde_ph""}"
I verified this by adding/removing characters one by one.
It seems there is a fixed internal buffer limit in the MQTT client for ESP8266.
Questions:
1. Is there a documented payload/topic size limit for Publish2 on ESP8266?
2. Is this a known limitation or a bug?
3. Is there a recommended workaround (larger buffer, Publish instead of Publish2, etc.)?
Thanks,
Mania