zhaojh329 / lua-eco

🐛Lua-eco is a Lua interpreter with a built-in event loop for scheduling lightweight coroutines automatically, enabling efficient concurrency in Lua. Build high-performance, scalable applications.
MIT License
75 stars 13 forks source link

MQTT spuriously retransmits #9

Open nwf opened 2 months ago

nwf commented 2 months ago

https://github.com/zhaojh329/lua-eco/blob/3b69a48ca3ac50f48ea0a09996d78e49b72a44ca/mqtt.lua#L181 will retransmit messages even if the TCP link is healthy, such that the earlier copies are still likely to reach the broker. AIUI, retransmission should occur only in the case that the connection drops and is re-established and this is mandated in MQTT 5 (see https://www.hivemq.com/blog/mqtt5-essentials-part2-foundational-changes-in-the-protocol/ , though I'm having trouble finding the claimed prohibition in the actual spec document).

zhaojh329 commented 2 months ago

I am really confused about the mqtt message retransmission mechanism. You are welcome to submit your code to improve it.