Added explicit settings to control segmented write length and delay#333
Added explicit settings to control segmented write length and delay#333ehong-tl wants to merge 4 commits into256dpi:masterfrom
Conversation
Allow to set partial write length for each successive client write into network buffer, as well as delay for each successive partial write.
|
Thanks for taking the time to compose this PR! Unfortunately, I cannot merge this right away. The changes to lwmqtt, would need to be submitted to its repository first. But I generally think that for such a problem there would be a better approach: The library already uses the Arduino Client interface to interact with the network layer. A class that wraps a Client and also implements the Client interface, could efficiently impose the max. write buffer restriction and add the required delays. We could add the class as part of an example for the board you're using. This would be a much better separation of concern. WDYT? |
|
How about adding the maxPartialWriteLength and partialWriteDelayms variables into lwmqtt_arduino_network_t structure and they can be accessed via ref pointer in the inline lwmqtt_arduino_network_write function? This will not modify the lwmqtt library. I try not to touch the Client interface as I believe some of the network libraries have their own implementation of Client wrapper for their device. I'll try this on Monday. |
Revert lwmqtt back to original and modify MQTTClient instead. Added variables to lwmqtt_arduino_network_t structure for network segmented write and delay control.
|
Hey @256dpi I tested the latest code changes, and everything is working perfectly. :) |
Added a method to set the maximum data length to be written into the network buffer in segments, as well as a method to set the delay between each successive write.
This helps prevent network overloading and network buffer overflow, particularly when using an external GSM/LTE module like the u-blox LARA R280, which I'm using for my project.