Skip to content
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

Create individual buffer sizes for sending and receiving buffers #13

Conversation

jpeterse
Copy link

@jpeterse jpeterse commented Dec 4, 2024

After pull request #10 the memory need of the library doubled.
Not a big issue if default buffer size is used.
But in my case, I integrate with Home Assistant, which need some fairly large MQTT messages to provision a device into the platform. The messages returned by Home Assistant however, are small.
My sending buffer need to be > 1150 bytes, while I only need about 150 bytes for the receiving buffer.

So I suggest the following changes.
Add the ability to separate sizes for sending and receiving buffers.

My proposed implementation does introduce breaking changes.
setBufferSize method has an additional parameter, and function getBufferSize is renamed.

I propose the breaking changes, because while setting a default value to the second parameter of setBufferSize function, and make a new function to set the other buffer, could make the interface persistent with current implementation, it would make it unclear which buffer size is being set.
Equally, getBufferSize would no longer clearly articulate which buffer size it is returning.

Overall, it's my opinion that the overall benefit of better memory utilization justify the breaking changes.

I also noticed from #11 , that the receiving buffer is used to submit user credentials to the broker. I have submitted separate pull request for the connect function to use the send buffer instead. Thereby, making sure it use a buffer that are appropriately sized.

Add individual buffer sizes for sending the receiving buffers
@jpeterse jpeterse changed the title Create individual buffer sized for sending and receiving buffers Create individual buffer sizes for sending and receiving buffers Dec 4, 2024
@jpeterse jpeterse marked this pull request as ready for review December 4, 2024 00:56
@imbeacon imbeacon merged commit a5fbcc3 into thingsboard:master Dec 9, 2024
@uschindler
Copy link

I think this should be a major release, as API changes.
So should be 1.11.0

@uschindler
Copy link

See changes in header file.
So when merging this, a new major release is needed.

@MathewHDYT
Copy link

MathewHDYT commented Dec 9, 2024

Agreed that is also what I advised for in the merged PR 12. Additionally I will also work on fixes in the ThingsBoard Client SDK to integrate the breaking changes of this API as soon as possible.

@MathewHDYT
Copy link

@imbeacon Would be nice if the newest release v2.11.0 could also be released on PlattformIO and ArduinoIDE.

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

Successfully merging this pull request may close these issues.

4 participants