This would increase the size of modules, effectively taking away storage space from users' needs.
QUERY · ISSUE
If any possible to make umqtt to support Qos 2?
Look through the Doc and code, i found Qos=2 messages are not supported in umqtt module.It's good to keep the code size small,but this function will make this module more larger ? i am curious
CANDIDATE · PULL REQUEST
umqtt documentation
I was recently using the library and thought it might be helpful to include some more documentation in the code. The documentation I added is pep8 compliant and gives some information on what variable types the various inputs are. It's not much, but I hope it helps!
1 comment
I am interested to know too
qos 2 is needed sometimes
Yes, implementing support for QOS 2 will increase the code size of the
umqtt.simplemodule. Currently thepublishmethod only handles QOS 0 and 1 and the logic for receivingPUBLISHpacket from the server in thewait_msgmethod also only handles QOS 0 and 1.For QOS 1 the method has to listen for a
PUBACKpacket from the server after it sends aPUBLISHpacket.For QOS 2 the client, after sending the
PUBLISHpacket, has to listen for aPUBRECpacket from the server, then send aPUBRELpacket and then listen for aPUBCOMPpacket.The simplistic way to implement this would be to handle all this in a synchronous, blocking fashion, i.e. for publishing client -> server, in the method
publishreplace theassertin line 142 with somethings like this (pseudo code):And for receiving QOS 2 from server -> client, do something like this in the
wait_msgmethod at line 197:The problem with this is:
PUBRECorPUBCOMPresp. thePUBRELpackage, the client will block forever (same it does currently with QOS 1, if noPUBACKis received)-.The only way I see around these problems is handling reception of all packet types in
wait_msgand passing them to different callback methods. But that would a) make a record of sent and received packet ids necessary (which increases memory requirements) and b) go against the stated goal of the module to avoid "callback hell".@SpotlightKid Thank you so much!!
this was so helpful indeed, my gratitude.
@SpotlightKid Thank You ! that's pretty awesome
Is this still relevant? Are there other MQTT implementations that people know of that support QoS 2 ?