Hi, I am trying to connect to HiveMQ Cloud with an ESP32, but the mqtt server rejects the connection with the message “rc-2”. I use the WIFIClientSecure library. I need your help. Thank you very much.
Hi Omar,
Welcome to the HiveMQ Community!
You indicated that the HiveMQ Cloud broker has rejected the connection with the message “rc-2”. According to the MQTT specification, CONNACK return code 2 means “0x02 Connection Refused, identifier rejected” i.e. “The Client identifier is correct UTF-8 but not allowed by the Server”.
First step hence is to check what is the client id
that your device is using.
More info on the return codes:
- MQTT Specification
- MQTT Client and Broker and MQTT Server and Connection Establishment Explained - MQTT Essentials: Part 3
Kind regards,
Dasha from HiveMQ Team