-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Null packet identifier rejected #1249
Comments
I believe your interpretation of the spec to be incorrect. I believe it is stating that SUBSCRIBE and UNSUBSCRIBE packets (which are always QoS 1) must contain a non-zero identifier. In addition PUBLISH packets which contain a packet identifier (i.e. those that are QoS > 0) must use a non-zero identifier. For PUBLISH packets using QoS=0, the packet identifier value is not important because it is not part of the packet. If you refer back to version 3.1 of the spec the intention is much clearer (message ID and packet identifier are the same thing):
Mosquitto is now stricter in some situations (as you have seen), in accordance with the mandatory statement
From my point of view that means this is a "not a bug", unless you can provide better reasons to the contrary. I'm afraid in this situation appealing to Postel's law won't work. |
Thanks for explaining how to read the specification; indeed with your clarification in mind, I see that "in cases where" in 2.3.1 was only meant to apply to PUBLISH, not to each of the three preceding message types. Table 2.5 further confirms your interpretation. I'm sorry to have wasted your time :) (Regarding Postel's law, a case could be made for bugward compatibility, but I completely agree that it is fair and less of a maintenance burden to decide otherwise.) |
Issue #6 was actually a bug. See eclipse/mosquitto#1249.
Not a problem, I'd prefer to have things checked than not. Plus it was easier writing that explanation than many bugs I've needed to fix. |
Mosquitto now (tested with 1.6.1) seems to require a non-null packet identifier for SUBSCRIBE messages. In previous versions (at least up to 1.5.8) it would allow
\0\0
.The MQTT 3.1.1 specification says:
However, mosquitto enforces this requirement for any QoS, instead of only where QoS > 0. I believe this is a bug. It certainly causes incompatibility with existing lazily implemented libraries (e.g. Juerd/Net-MQTT-Simple#6), and even though it's easy enough to work around, I think the old behavior of mosquitto was better because it more closely matched the MQTT 3.1.1 specification.
The text was updated successfully, but these errors were encountered: