📝 MQTT 5: expose structured metadata from broker DISCONNECT packets (#89)
Problem
In zmqtt 0.2.1, a broker DISCONNECT becomes a generic
MQTTDisconnectedError containing the reason code only in its message text. Decoded Reason String, User Properties, and Server Reference are discarded. Applications cannot reliably inspect why the broker closed the connection.The relevant paths are
_dispatch(), DisconnectProperties, and MQTTDisconnectedError.Expected behavior
Implement support for MQTT 5 §3.14, DISCONNECT:
• Expose the broker's reason_code, Reason String, User Properties, and Server Reference as structured public data.
• Make the event observable even when automatic reconnect subsequently succeeds.
• Preserve these details when a broker disconnect is propagated to affected callers.
• Distinguish a broker DISCONNECT from a transport failure where no MQTT reason code was received.
• Keep duplicate User Property keys and avoid requiring applications to parse exception text.
Related: #85 exposes the corresponding CONNACK metadata. Following Server Reference is a separate feature.
#good_first_issue #opensource_september #faststream #zmqtt
sent via relator