Bi-directional disconnect

In MQTT3, a client could perform a proper Disconnect with the message broker, i.e., the client notified the broker of the disconnection. However, the protocol did not allow the message broker to inform the clients that it was disconnecting.

In MQTT5 there is now such a mechanism. The message broker can send an MQTT Disconnect packet to the clients and also specify a Reason Code for the disconnection.