MQTT return codes
When a MQTT broker (server) receives a CONNECT message from a client, it has to reply with a CONNACK message.
The CONNACK message contains a flag which returns a return code. This tells whether the connection attempt is successful or not. Here are the return codes:
| Return Code | Response | ||||
|---|---|---|---|---|---|
| 0 | Connection accepted | ||||
| 1 | Connection refused: level of MQTT protocol not supported by server. | ||||
| 2 | Connection refused: client identifier not allowed by server. | ||||
| 3 | Network connection successful but MQTT service is unavailable. | ||||
| 4 | Data in username or password is malformed. | ||||
| 5 | Client not authorized to connect. | ||||
| 6-255 | Reserved for future use. |
Links
http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718035