-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
messages loss when QOS=1 #114
Comments
Apart from the Broker response(CONNACK) to the connect() call, phpMQTT does not have any code There is also a bug in the function subscribe($topics, $qos = 0). If you set QoS=1, phpMQTT code will add that to the existing header 0x82 code (which is already at QoS=1) which effectively makes the subcribe request QoS=2. This is illegal (QoS must be 1 for this request) so the Broker will terminate the connection immediately. This should not even a choice for the subscribe() request call. Note that this QoS is different from the QoS=0..2 for each topic subscribed which is specified separately. A lot more code will need to be added if phpMQTT is to usable at QoS > 0. I also notice some code at the end of the proc() function (lines 561..568) which seem to enforce a session timeout to initiate an auto disconnect . This is not required because the Broker will never initiate sending anything so the connection being idle is normal. Potentially this code may cause some data loss, but I have not investigated into this to see if this code is ever executed or not. |
The same problem |
when I set QOS=1 and I sent 500 messages at one time, I find only a few messages could be accepted.
The text was updated successfully, but these errors were encountered: