B4R Question MQTT Payload() size ?

Andrej Meszaros

Member
Licensed User
Longtime User
Hi,

is there a limit for sending Payload in MQTT library ?
I can send small packet .. cca 30 bytes, but packet with 255 bytes doesnt to send.

Andrej
 

inakigarm

Well-Known Member
Licensed User
Longtime User
As B4R MQTT library is based on https://github.com/knolleary/pubsubclient , it seems that MQTT_MAX_PACKET_SIZE is hardcoded to 128 bytes in PubSubClient.h (in B4R Libraries/rMQTT Folder)

I suppose that changing to 255 will do the job (NOT Tested !!)

B4X:
// MQTT_MAX_PACKET_SIZE : Maximum packet size
#ifndef MQTT_MAX_PACKET_SIZE
#define MQTT_MAX_PACKET_SIZE 255
#endif
 
Upvote 0

Andrej Meszaros

Member
Licensed User
Longtime User
In B4R there is no possibility to use this.
// MQTT_MAX_PACKET_SIZE : Maximum packet size
#ifndef MQTT_MAX_PACKET_SIZE#define MQTT_MAX_PACKET_SIZE 255#endif
 
Upvote 0

inakigarm

Well-Known Member
Licensed User
Longtime User
In B4R there is no possibility to use this.
// MQTT_MAX_PACKET_SIZE : Maximum packet size
#ifndef MQTT_MAX_PACKET_SIZE#define MQTT_MAX_PACKET_SIZE 255#endif
Maybe I didn't explain correctly; this option is not in B4R IDE;you'll have to find PubSubClient.h file in B4R Libraries/rMQTT folder (search for it in your HD), and edit this field (actual value 128 and modify to 255 )
 
Upvote 0

Andrej Meszaros

Member
Licensed User
Longtime User
Thank You for detail explain. I found the file, edit to 255 but not working.
After change the buffer size to 300 I can send 256 byte packet.
 
Upvote 0
Top