-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Max Message size #501
Comments
Hi - changing the settings via PubSubClient.h is the only supported way of changing the value. |
@knolleary With the 2.7.0 changes to allow large messages to be published, did the requirement to modify MQTT_MAX_PACKET_SIZE to receive large messages get changed? Is there something in the works? |
With the information above, I got the idea to try using build flags. In VSCode with PlatformIO, I was able to get this to work by configuring a define in a build flag in This should/could work in Arduino IDE as well, not tested though. |
The build flag that @lurkie provided worked perfectly! I'd recommend putting that in the README. |
I put the flag after the include and worked for me:
Putting before didn't work. On ESP8266. |
@RobertoDebarba using what ide/build tool? |
@knolleary Arduino |
To clarify the recommended course is to modify the macro def in the library? What is the process for using a library manager that isn't aware of changes? |
Reading the cpp and .h file you see that the limit is 256 and it could be set in various ways:
For me: This won't workfile.h This will workfile.h file.cpp |
head to PubsubClient/src available under libraries folder `#ifndef PubSubClient_h #include <Arduino.h> // MQTT_MAX_PACKET_SIZE : Maximum packet size. Override with setBufferSize(). |
This is fixed via the PubSubClient.setBufferSize(size) API now. @knolleary , please close this issue. |
How much is the maximum size we can keep? |
It seems that if you use a GSM modem you might be limited in how big a single message is allowed to be. Like on the SIM800L max size seems to be 1450bytes per message. Then you would have to split your payload. MQTT servers have limits per message set. And your microcontrollers memory is limiting you as well. |
This worked for me, thanks!
|
In the documentation, it stated:
Trying to override this in the application on an ESP32 processor by setting the "MQTT_MAX_PACKET_SIZE" to a new value in the application, will allocate the storage needed, but the pubsubclient will never receive a message greater than the value preset in the .h file. ie: It allocated storage, but there appears to be some parameter(s) in the .h file that is not referencing the new allocation correctly.
Changing the setting it in the "PubSubClient.h" works just fine...
ESP32 code load of 2 Oct 2018
Arduino 1.8.5
pubsubclient 2.6.0
The text was updated successfully, but these errors were encountered: