espressif / esp-mqtt

ESP32 mqtt component
Apache License 2.0
603 stars 255 forks source link

the doc should mention when QoS is zero, esp_mqtt_client_publish() always returns zero (IDFGH-1760) #127

Closed trombik closed 5 years ago

trombik commented 5 years ago

https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/protocols/mqtt.html#_CPPv423esp_mqtt_client_publish24esp_mqtt_client_handle_tPKcPKciii states that:

return message_id of the subscribe message on success 0 if cannot publish

this, grammatically, does not make sense and the subscribe message should have meant the published message.

when QoS is zero, the return value is always zero because mqtt_msg_publish() sets message_id to zero.

https://github.com/espressif/esp-mqtt/blob/18b6f2c58231728805ff813d46021d07ed023dcb/lib/mqtt_msg.c#L433

david-cermak commented 5 years ago

Thanks for raising this issue, will be fixed.