Exception thrown when package format is somehow malformed
Connect Return code values - 0 = accepted, the rest means refused (6-255 are reserved)
MQTT Control Packet type
Indicates the level of assurance for delivery of an Application Message http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Table_3.11_-
Responce to Connect request
Connect Acknowledge Flags
After a Network Connection is established by a Client to a Server, the first Packet sent from the Client to the Server MUST be a CONNECT Packet.
The Connect Flags byte contains a number of parameters specifying the behavior of the MQTT connection. It also indicates the presence or absence of fields in the payload.
The DISCONNECT Packet is the final Control Packet sent from the Client to the Server. It indicates that the Client is disconnecting cleanly.
Each MQTT Control Packet contains a fixed header.
The PINGREQ Packet is sent from a Client to the Server. It can be used to:
A PINGRESP Packet is sent by the Server to the Client in response to a PINGREQ Packet. It indicates that the Server is alive. This Packet is used in Keep Alive processing.
A PUBACK Packet is the response to a PUBLISH Packet with QoS level 1.
The PUBCOMP Packet is the response to a PUBREL Packet. It is the fourth and final packet of the QoS 2 protocol exchange.
A PUBREC Packet is the response to a PUBLISH Packet with QoS 2. It is the second packet of the QoS 2 protocol exchange.
A PUBREL Packet is the response to a PUBREC Packet. It is the third packet of the QoS 2 protocol exchange.
A PUBLISH Control Packet is sent from a Client to a Server or from Server to a Client to transport an Application Message.
A SUBACK Packet is sent by the Server to the Client to confirm receipt and processing of a SUBSCRIBE Packet. A SUBACK Packet contains a list of return codes, that specify the maximum QoS level that was granted in each Subscription that was requested by the SUBSCRIBE.
The SUBSCRIBE Packet is sent from the Client to the Server to create one or more Subscriptions. Each Subscription registers a Client’s interest in one or more Topics. The Server sends PUBLISH Packets to the Client in order to forward Application Messages that were published to Topics that match these Subscriptions. The SUBSCRIBE Packet also specifies (for each Subscription) the maximum QoS with which the Server can send Application Messages to the Client.
The payload of a SUBSCRIBE Packet
The UNSUBACK Packet is sent by the Server to the Client to confirm receipt of an UNSUBSCRIBE Packet.
An UNSUBSCRIBE Packet is sent by the Client to the Server, to unsubscribe from topics.
/home/tomas/workspace/mqtt-d/source/mqttd/message.d