async-mqtt-client: Unable to publish messages
Hi, I am using this library to connect to a broker which is indeed successful and returns the onConnect callback and even the subscribe acknowledge log when subscribing. However, when I publish a message on the topic there is no acknowledgment received i.e doesn’t trigger onPublish callback.
I am also receiving a session present as False. Is that the issue causing this?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 28
https://github.com/kleini/async-mqtt-client/commit/f1b42054815ad82fed4519bce7febb7f1601560f <- this helps me a lot in Homie when larger chunks of MQTT messages should be sent and the TCP buffer is not large enough and packets are dropped. I have stolen this fix somewhere but I don’t remember where.
A remark: when I use this lib I make a message queue and only send the next message when the previous is acked. For this to work, you also need to have the
onPublishcallback for QOS0. I also made anonPingcallback because this could interfere. This queue is particularly useful when using SSL because axTLS uses shared buffers and can get easily corrupted.(I can’t share but the queue is pretty straightforward)
Yes, receiving is already implemented in the lib: the message callback has the index and length as parameters so you can “rebuild” the complete message.
That workaround doesn’t solve the low TCP buffer problem. It just creates an intermediate buffer. You seem to have a very low TCP buffer, meaning you don’t seem to receive acks (which clear the buffer).
You can try to use the PR for large payloads (https://github.com/marvinroger/async-mqtt-client/pull/184) but I doubt it will work. Can you build with debug enabled in ESPAsyncTCP?
This would mean your tcp’s sendbuffer is less then 273 (+ overhead). Are you on ESP32 or ESP8266?