Hello,
I'm trying to connect my esp32 as mqtt client to HiveMQ Cloud. This one use TLS over 8883 and username and password credentials.
I tried the PPPOS client and with the eclipse : "mqtt://mqtt.eclipseprojects.io" it's OK.
The problem is that when I want to change it to use : "mqtts://9c2cf507f4604f8eb8db547c2fc2ee1c.s1.eu.hivemq.cloud", I don't see how configure credential ans so the connection to the broker is failed...
Is anybody had use this cloud broker and can share a working exemple or explain hox setting credential in esp-idf ?
HiveMQ Cloud credentials for MQTT over TLS
-
- Posts: 21
- Joined: Wed Mar 04, 2020 7:14 pm
Re: HiveMQ Cloud credentials for MQTT over TLS
mqtt://username:password@mqtt.eclipseprojects.io:1884 MQTT over TCP, port 1884, with username and password ?
like described here ?
https://docs.espressif.com/projects/esp ... /mqtt.html
like described here ?
https://docs.espressif.com/projects/esp ... /mqtt.html
-
- Posts: 21
- Joined: Wed Mar 04, 2020 7:14 pm
Re: HiveMQ Cloud credentials for MQTT over TLS
for me this worked:
mqtts:///username:password@xxxxxxxx.s2.eu.hivemq.cloud:8883
on this Example:
https://github.com/espressif/esp-idf/tr ... s/mqtt/ssl
certificate for Eclipse and hive is same.
mqtts:///username:password@xxxxxxxx.s2.eu.hivemq.cloud:8883
on this Example:
https://github.com/espressif/esp-idf/tr ... s/mqtt/ssl
certificate for Eclipse and hive is same.
Re: HiveMQ Cloud credentials for MQTT over TLS
Hi,
I use ESP32 ESP-IDF example (https://github.com/espressif/esp-idf/bl ... app_main.c) to try connect to HiveMQ cloud but I get the error shown in the attachment
I have tested my CA certification file, username, password and client ID by successfully connecting via "MQTT explorer" application.
The url (mqtts://xxxxxxxx.s2.eu.hivemq.cloud:8883) doesn't contain username and password since I realized I could add them (code snippet shown below).
Certification file taken from here https://community.hivemq.com/t/frequent ... stions/514
Any ideas what could be wrong ?
I use ESP32 ESP-IDF example (https://github.com/espressif/esp-idf/bl ... app_main.c) to try connect to HiveMQ cloud but I get the error shown in the attachment
I have tested my CA certification file, username, password and client ID by successfully connecting via "MQTT explorer" application.
The url (mqtts://xxxxxxxx.s2.eu.hivemq.cloud:8883) doesn't contain username and password since I realized I could add them (code snippet shown below).
Code: Select all
const esp_mqtt_client_config_t mqtt_cfg = {
.broker = {
.address.uri = CONFIG_BROKER_URI,
.verification.certificate = (const char *)mqtt_eclipseprojects_io_pem_start
},
.credentials ={
.username= "my_username",
.client_id= "ESP32_95989e", // << you can ommit this line. client ID is constructed and sent automatically
.authentication.password = "my_password"
}
};
Any ideas what could be wrong ?
- Attachments
-
- 4b85cf58c9e81db3f524f9af1324901f1bec2f34.png (8.36 KiB) Viewed 3255 times
Re: HiveMQ Cloud credentials for MQTT over TLS
Found the problem.Stupid mistake. I had copy-pasted the same url twice in the appropriate field in menu config but couldn’t see it because the field is too small. I realized it when I moused over the uri variable.
Who is online
Users browsing this forum: No registered users and 285 guests