Mqtt protocol v5 definition (rebased onto 0.29 + per-message properties) - #87
Open
danielmeza wants to merge 3 commits into
Open
Mqtt protocol v5 definition (rebased onto 0.29 + per-message properties)#87danielmeza wants to merge 3 commits into
danielmeza wants to merge 3 commits into
Conversation
Introduces a new 'mqtt_protocol_v5' feature and the src/mqtt/client5.rs module implementing MQTT 5.0 protocol traits, property configs, and error codes. Updates src/mqtt.rs and src/mqtt/client.rs to integrate v5-specific APIs and types, enabling advanced MQTT 5.0 features such as user properties, message metadata, and extended event handling.
Added Default implementations for PublishPropertyConfig, SubscribePropertyConfig, UnsubscribePropertyConfig, and DisconnectPropertyConfig. Updated Client and Publish traits (and their async variants) to accept Option<T> for property config parameters, making them optional. This improves API ergonomics and allows callers to omit property configs when not needed.
Updated the Event trait and UserPropertyList trait to use Vec<UserPropertyItem> instead of Box<dyn UserPropertyList> and adjusted lifetimes for better ergonomics and type safety. This simplifies the interface for accessing user properties in MQTT v5 and improves compatibility with standard collections.
This was referenced Aug 16, 2026
danielmeza
added a commit
to danielmeza/esp-idf-svc
that referenced
this pull request
Aug 16, 2026
Cargo validates `dep/feature` references in the manifest even when the feature is not activated, so naming `embedded-svc/mqtt_protocol_v5` fails resolution against the published embedded-svc 0.29.0 regardless of gating. Add embedded-svc to the existing sibling-crate patch table, the same way esp-idf-sys and esp-idf-hal are already handled, so the crate resolves once esp-rs/embedded-svc#87 lands on master.
This was referenced Aug 16, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebase of #84 (
mqtt-protocol-v5) onto the currentmaster(0.29.0).Changes
Add MQTT 5.0 protocol support with client5 module,Add Default impls and make property configs optional in MQTT v5,Refactor user properties API for MQTT v5) onto upstreammaster.Cargo.tomlconflict by keeping the current dependency versions (heapless 0.9, embedded-io 0.7) — the olddefmt-03feature flags were dropped in favor of the currentdefmtfeature.mqtt_protocol_v5feature flag; adds theclient5module with MQTT v5 client traits (Client,Publish,Subscribe,Unsubscribe,Enqueue, property configs,UserPropertyItem/UserPropertyList).Design drivers (from the original PR)
How the traits map onto the MQTT 5.0 specification
References are to MQTT Version 5.0, OASIS Standard, 07 March 2019; each link is a section anchor in that published HTML.
PublishPropertyConfigSubscribePropertyConfigUnsubscribePropertyConfigUserPropertyItem/UserPropertyListThe property configs are arguments of the publish/subscribe/unsubscribe methods rather than client construction parameters because MQTT 5.0 places them in the Variable Header of each packet.
UserPropertyListis a list rather than a map because §3.3.2.3.7 states "The User Property is allowed to appear multiple times to represent multiple name, value pairs. The same name is allowed to appear more than once." Connection-scoped properties (§3.1.2.11 CONNECT Properties) stay on the client configuration, where they belong.Part of #83 and esp-rs/esp-idf-svc#589.
Testing
cargo check --features mqtt_protocol_v5,stdpasses.esp-idf-svc(feat(mqtt): add MQTT v5 client5 module with per-message properties esp-idf-svc#678 —client5impl, per-message publish/subscribe/unsubscribe) typechecks against this branch.