Tuesday, June 23, 2015

Dissecting MQTT Connect CONNACK message

CONNACK message is sent in response to the CONNECT request. 

Below are the components in a CONNACK Request 

1. Fixed Header
2. Variable Header 

There is no PAYLOAD for the CONNACK request. 

Below is a Wireshark trace for the CONNACK message. 



Fixed header is again two bytes

Message Type will indicate value 2, so the first byte will look like 20 
Second byte tell the remaining length, which is again 02, which represents the variable length header

In the variable header, which is again 2 bytes, the first byte is not used and it is reserved as of now. 
Second byte represents the response code for the CONNECT request. Below are the  response codes possible for CONNECT request

0 - connection accepted 
1 - Connection refused, unacceptable protocol version
2 - connection refused, identifier rejected
3 - connection refused, server unavailable 
4 - connection refused, bad user name or password 
5 - connection refused, not authorized
6 to 255 - reserved for future use. 


References:

1 comment:

  1. A debt of gratitude is in order for setting aside an ideal opportunity to talk about this, I feel unequivocally about it and affection adapting more on this subject. Bulk SMS in Pune

    ReplyDelete