-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
net: mqtt: Add MQTT 5.0 support #87354
Conversation
7c18434
to
0ab24bc
Compare
It should be possible to select maximum supported MQTT version, so that for example MQTT 5.0 features can be compiled-out in case they're not needed. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add test variant which enables MQTT 5.0 support. MQTT 3.1.1 should still work just fine in such case, so it needs to be verified that's the case. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The macro did not take into account the 2-byte binary data length encoded before the actual binary data. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for CONNECT message specified in MQTT 5.0, along with property encoders required to encode MQTT properties which is a new concept in MQTT 5.0. Connect and will properties can be specified by the application in the mqtt_client structure before connecting. Introduce a helper function which allows to verify whether MQTT 5.0 is used or not, so that it's still possible to use MQTT 3.1 even if MQTT 5.0 support is enabled in Kconfig. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Updated docstrings & rebased to resolve conflict. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a full review yet, some early comments.
Thanks @pdgendt, I've addressed the initial nits, waiting for more :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More nits :)
Only have some bare minimum experience with MQTT, but the PR looks complete with extensive testing, and it is marked as experimental.
Add support for CONNACK message specified in MQTT 5.0, along with property decoders required to decode MQTT properties. Decoded properties are provided to the application within mqtt_connack_param structure, accompanying the CONNACK event. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for PUBLISH message specified in MQTT 5.0. The message encoder and decoder were updated to support MQTT properties. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for PUBACK, PUBREC, PUBREL and PUBCOMP specified in MQTT 5.0. As all of these acknowledgment packets have similar format, introduced a common encoder/decoder to handle ACK packets. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for SUBSCRIBE/UNSUBSCRIBE messages specified in MQTT 5.0. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for SUBACK/UNSUBACK messaged specified in MQTT 5.0. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for DICONNECT message specified in MQTT 5.0. As with MQTT 5.0, the disconnect can now also be initiated by the broker, it was needed to add decoder support for the message. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for a new AUTH message introduced in MQTT 5.0. This is a new mechanism specified by MQTT 5.0, which allows clients and brokers for enhanced authentication in between CONNECT and CONNACK exchange. An additional MQTT event (MQTT_EVT_AUTH) was specified which is triggered when the AUTH packet arrives from the broker. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for handling topic aliases received from the broker. The MQTT client implementation will store received topic for further use in case consecutive PUBLISH received from the broker contains no topic but alias only. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As MQTT 5.0 allows to specify the disconnect reason in the Disconnect packet, use this new feature to improve error notification to the broker, according to the error guidelines in the MQTT 5.0 spec. For most cases, a generic arbitrary mapping between errno values and reason codes is used, however the parser can specify the disconnect reason code manually to better handle certain corner cases (like invalid topic alias used). Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add new test suite covering MQTT 5.0 packet format. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make sure conditionally compiled parts of the public header related to MQTT 5.0 support are rendered by doxygen. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Update migration guide for 4.2 release with an entry about the API change related to MQTT 5.0 support. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add bullet for 4.2 release notes about MQTT 5.0 support. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
MQTT 5.0 is now supported so reflect this in the library documentation. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add MQTT 5.0 support and some basic tests. MQTT 5.0 support should mostly be transparent for MQTT 3.1.1 users (even if the Kconfig option is enabled), however one stable API change was required, which was reflected in the migration guide.
Resolves #21633