I am trying to connect to the MQTT service of AWS IoT using the MQTT API of the ESP32 IDF, and I have the following code:
Code: Select all
char complete_uri[60];
sprintf(complete_uri, "mqtts://%s:%d", url, port);
const esp_mqtt_client_config_t mqtt_cfg = {
.broker = {
.address ={
.uri = complete_uri
},
.verification.certificate = certificate,
},
.credentials = {
.authentication ={
.key = private_key
},
.client_id = client_id
}
};
esp_mqtt_client_handle_t client = esp_mqtt_client_init(&mqtt_cfg);
esp_mqtt_client_register_event(client, ESP_EVENT_ANY_ID, mqtt_event_handler, NULL);
esp_err_t conn_validation = esp_mqtt_client_start(client);
Thanks in advance!