MQTT Control Packets
The MQTT protocol works by exchanging a series of MQTT Control Packets in a define way. This section provides an overview of MQTT Control Packets and a list of Packet Types used in deviceWISE Cloud. An MQTT Control Packet consists of three parts fixed header(present in all packets), variable header(optional) and Payload(optional)
Each MQTT Control Packet contains a fixed header. The following is the format of the fixed header.
Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
Byte 1 | MQTT Control Packet Type | Flags (Specific to Control Packet type) | ||||||
Byte 2 | Remaining Length |
The following MQTT Control packets are supported in the deviceWISE Cloud.
Packet Type | Description | Value | Direction of flow | Flags |
---|---|---|---|---|
CONNECT | Client requests a connection to a Server | 1 | Client to Server | Reserved |
CONNACK | Acknowledge connection request | 2 | Server to Client | Reserved |
PUBLISH | Publish message | 3 | Client to Server or Server to Client | Used1 |
PUBACK | Publish acknowledgment | 4 | Client to Server or Server to Client | Reserved |
SUBSCRIBE | Subscribe to topics | 8 | Client to Server | Reserved |
SUBACK | Subscribe acknowledgment | 9 | Server to Client | Reserved |
UNSUBSCRIBE | Unsubscribe from topics | 10 | Client to Server | Reserved |
UNSUBACK | Unsubscribe acknowledgment | 11 | Server to Client | Reserved |
PINGREQ | Ping request | 12 | Client to Server | Reserved |
PINGRESP | Ping response | 13 | Server to Client | Reserved |
DISCONNECT | Disconnect notification | 14 | Client to Server | Reserved |