hirotakaster / MQTT

MQTT for Photon, Spark Core
Other
217 stars 118 forks source link

max publish message size #29

Closed phouse512 closed 8 years ago

phouse512 commented 8 years ago

our team has started using this code in some of our sensors, and we came across an issue with the max size of messages you can publish. Our messages were getting cut off at around 238 characters and we couldn't figure out how until we looked at the code in MQTT.h and found this variable: MQTT_MAX_PACKET_SIZE that was set to 255. In our fork, we modified the value to be something more appropriate for us, and didn't suffer any other bugs as a result.

I was curious, was there a specific reason this was set to 255? We are trying to figure out if there might be any repercussions to this change, although we haven't discovered any yet.

hirotakaster commented 8 years ago

Hi, it's no problem over 255 size. Old Particle(Spark/Photon, and Arduino) TCP stack firmware have some buggy, can't send large data with some problem. So I commited "MQTT_MAX_PACKET_SIZE 128" on first version of this library. And I thought sensors don't send big size data at once. But now, it's stable and can send bit size. And more I think MQTT_MAX_PACKET_SIZE is dependent on MTU(Photon TI CC3000 MTU = 1468byte), so MQTT_MAX_PACKET_SIZE can up to about 1400.