Skip to content

make TX_PAYLOAD_BUFFER_SIZE overridable #10

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

Closed
ravelab opened this issue Aug 17, 2019 · 7 comments
Closed

make TX_PAYLOAD_BUFFER_SIZE overridable #10

ravelab opened this issue Aug 17, 2019 · 7 comments

Comments

@ravelab
Copy link

ravelab commented Aug 17, 2019

Hi, is it possible to make TX_PAYLOAD_BUFFER_SIZE overridable, as an instance variable, or compile build option? I was surprised to find that it is only 256 bytes. Thanks

@sandeepmistry
Copy link
Contributor

Hi @ravelab,

I'm ok with merging the changes you proposed in #11.

One note, before I do, if you happen to know the size of your message before hand you can pass it into beginMessage(...): https://github.com/arduino-libraries/ArduinoMqttClient/blob/master/examples/WiFiAdvancedCallback/WiFiAdvancedCallback.ino#L147-L149

Would this cover your use case?

@ravelab
Copy link
Author

ravelab commented Sep 4, 2019

Hi, @sandeepmistry

It does cover my use case, I missed that beginMessage(...) option. It's up to you if you want to make TX_PAYLOAD_BUFFER_SIZE overridable.

Thanks.

@sandeepmistry
Copy link
Contributor

Hi @ravelab,

Great! I'm going to close your pull request for now, if someone requests the feature in the future we can re-open the your pull request and merge.

@sakurai-youhei
Copy link

sakurai-youhei commented Aug 28, 2020

Hi @sandeepmistry and @ravelab, Time has come. :)

Could you re-open this issue, merge the PR #11 and release it as next version, please?

I hit one issue when uploading JSON document of ArduinoJson.

#include <ArduinoJson.h>

DynamicJsonDocument doc(256);
for (int i = 0; i < 100; i++) {
  doc["I"]["am"]["creating"]["big"]["JSON"]["document"][String(i)] = "which size can't be estimated beforehand.";
}
mqtt.beginMessage("topic");
serializeJson(doc, mqtt);
mqtt.endMessage();

See also: How to use ArduinoJson with ArduinoMqttClient?

Thank you.

@OldGreyCells
Copy link

OldGreyCells commented Jan 15, 2021

Hi @ravelab,

Great! I'm going to close your pull request for now, if someone requests the feature in the future we can re-open the your pull request and merge.

It would be much appreciated if you could reopen this. The payload for auto discovery in Home Assistant is often > 256!
If possible via a setPayloadBufferSize() method or a bufferSize arg in beginMessage() rather than via a #define, so it can be set per message (payload for most messages is small, only occasionally does the buffer need to be enlarged).
Many thanks

@tbaust
Copy link
Contributor

tbaust commented Jul 27, 2021

Hi @ravelab,

Great! I'm going to close your pull request for now, if someone requests the feature in the future we can re-open the your pull request and merge.

please reopen this - I had the issue that (depending on the floating point conversion) sporadic the MQTT messages are invalid. This is really hard to find if it occurs roughly once per day...

Thank you.

@per1234 per1234 reopened this Jul 30, 2021
@aentinger
Copy link
Contributor

Fixed by #44.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants