-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
MQTT client: limit outbox size (IDFGH-7527) #9090
Comments
Hi @kotyara12 thanks for the suggestion. I'm looking into adding more control over the outbox, but you can already disable it via menuconfig providing a custom implementation. It's also possible to define a timeout for messages, using these two options you may have a temporary solution for your issue. |
Hello @euripedesrocha. I don't quite understand how to disable the send queue via menuconfig. I understand that in order to use a custom implementation, you need to write it, and I do not have enough knowledge in this matter. PS: In general, I am completely delighted with the multitasking ESP-IDF, after Arduino. |
Hi @kotyara12, I only pointed the custom outbox route because it's a way for you to not be blocked by our implementation time. |
Hello @euripedesrocha. Pay attention to this mechanism: Let's say we send a message "{big-big-json}" to the topic "device/topic1" Thank you. |
Hello, I also agree that this would be a great feature to have. |
@matiasstack unfortunately we don't have an example, but I suggest that you take our implementation as inspiration. If you look into our documentation, what is needed is to provide your version of the implementation of the API. |
@euripedesrocha |
@AxelLin, mqtt submodule is in process of update in the latest idf master and 5.1. For 5.0, that you are referring to, there is still an ongoing discussion about which features will be backported. |
(Top) → Component config → ESP-MQTT Configurations → Number of queued events This is it? How this option works (there is nothing about it in the help yet) |
@kotyara12 the outbox limitation is a runtime configuration. You can find the limit configuration in the mqtt client config structure. The availability will depend on which IDF version you are using and the version of esp_mqtt. |
@euripedesrocha, many thanks! |
Good day!
It is necessary to add the ability to limit the size of the outbox for mqtt_client or block it altogether (disable it).
The problem is the following. On a "good" WiFi connection, everything works fine, no problems.
But not all devices have a good WiFi connection, some of my devices are at the Wifi limit, -90dBi and below. And sometimes neighbors clog the channel so tightly that packet loss reaches 100%. In this case, mqtt queues messages. And this is good. But not much. The fact is that rather large JSON packets go to MQTT, from 512 bytes and above, sometimes 2-3 kilobytes. I can't quickly determine if there is a connection to the server or not. And the messages are queued. And the memory runs out very, very quickly, the device either freezes or reboots.
It is necessary to somehow limit the size of the outgoing mailbox, after which the "old" messages will be overwritten by new ones. I haven't found such an option yet.
And besides, it is very important that messages in the same topic are not duplicated in the outbox, but are filled with new ones.
The text was updated successfully, but these errors were encountered: