Closed davctv closed 4 years ago
Hi, davctv. Thanks for reporting this issue.
Yes, the error handling in the current version is not correct, as you point out it doesn't return -1 if it fails. If it fails sending you will get an MQTT_EVENT_ERROR
event, but currently there is no reliable way to detect other failures.
There is a merge request ready that should improve this.
Hi @david-cermak,
I'm using 'esp_mqtt_client_publish()' function but looking into source code I think that the return value -1 (fail) never occurs. It only returns 0 or pending_msg_id (which is never assigned to -1. Am I wrong?
Thus, how can I know if publish is completed correctly? I currently I check 'MQTT_EVENT_PUBLISHED' but what if 'esp_mqtt_client_publish()' fails and the message is not queued in the mqtt task?
Thanks in advance