-
Notifications
You must be signed in to change notification settings - Fork 92
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
Mqtt 5 puback is different from spec #92
Comments
I actually don't know. Would you like to send a PR? Can you check if this works with Mosquitto? |
@mcollina I can try but my java script skills are close to 0 |
Looking at the output @tekjar produced from mqtt-packet the last Byte is not the Property Length: [
0x40, 0x03, // Fixed Header (PUBACK, Remaining Length - 3 Bytes)
0x00, 0x2a, // Packet Identifier MSB, LSB: 42
0x00 // PUBACK Reason Code: Success
] The question remains as to whether the last Byte is necessary as both Mosquitto and HiveMQ ommit it (tested against their respective online test servers today). You need to infer that the Reason Code is Success per the comment in 3.4.2.1 "The Reason Code and Property Length can be omitted......": [
0x40, 0x02, // Fixed Header (PUBACK, Remaining Length - 2 Bytes)
0x00, 0x2a, // Packet Identifier MSB, LSB: 42
] Reading the specification I conclude that either is acceptable, as also this would be: [
0x40, 0x04, // Fixed Header (PUBACK, Remaining Length - 4 Bytes)
0x00, 0x2a, // Packet Identifier MSB, LSB: 42
0x00, // PUBACK Reason Code: Success
0x00 // Property Length
] I believe the format currently produced by mqtt-packet is valid, but not optimised. |
@mcollina should this be closed? |
@mcollina @bkp7 - Please reopen this issue - the format is not valid as is (and e.g. not accepted by RabbitMQ). What mqtt-paket generates is a message length of 3: And this is not valid to the spec:
https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901124 And generally talking about the properties length:
https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901028 |
@alaendle Please open a PR to fix the issue |
* Hack to solve #92. * Adapted tests - please note this is a breaking change on the wire - also it shouldn't be spec-wise. * More comments and improved puback handling. * Improved comments. --------- Co-authored-by: Andreas Ländle <969523+alaendle@users.noreply.github.com>
Spec says that if remaining len is < 4, there's no property length. I think 'there's no property length' implies that it's not part of the byte stream (beacause it checks out with mosquitto)
Output of the above code is
Output of ack from mosquitto with no reason code and properties is this
Is the last
0x00
necessary?The text was updated successfully, but these errors were encountered: