@pfalcon - I am not sure what additional info you need for this ?
-
Subscribe to Topic on Broker
-
Using another Client, publish a message with QOS = 2
-
mqtt-simple crashes while checking message:
checking... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "dev/mqtest.py", line 32, in <module> File "dev/mqtest.py", line 20, in connect File "/lib/umqtt_simple.py", line 192, in check_msg File "/lib/umqtt_simple.py", line 185, in wait_msg AssertionError:
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 ?