fix: Removes forward / from topics in examples and test

Cleans up examples to adhere to mqtt best practices
This commit is contained in:
Euripedes Rocha Filho
2025-11-26 14:31:54 +01:00
committed by Euripedes Rocha
parent a85f5c9509
commit 4c57d316c0
25 changed files with 91 additions and 96 deletions
+4 -4
View File
@@ -68,13 +68,13 @@ static void mqtt_app_start(void)
esp_mqtt_client_register_event(client, MQTT_EVENT_ANY, mqtt_event_handler, client);
esp_mqtt_client_start(client);
esp_mqtt_set_config(client, &mqtt_cfg);
int msg_id = esp_mqtt_client_publish(client, "/topic/qos1", "data", 0, 0, 0);
int msg_id = esp_mqtt_client_publish(client, "topic/qos1", "data", 0, 0, 0);
ESP_LOGI(TAG, "mqtt api returned %d", msg_id);
msg_id = esp_mqtt_client_subscribe(client, "/topic/qos0", 0);
msg_id = esp_mqtt_client_subscribe(client, "topic/qos0", 0);
ESP_LOGI(TAG, "mqtt api returned %d", msg_id);
msg_id = esp_mqtt_client_subscribe(client, "/topic/qos1", 1);
msg_id = esp_mqtt_client_subscribe(client, "topic/qos1", 1);
ESP_LOGI(TAG, "mqtt api returned %d", msg_id);
msg_id = esp_mqtt_client_unsubscribe(client, "/topic/qos1");
msg_id = esp_mqtt_client_unsubscribe(client, "topic/qos1");
ESP_LOGI(TAG, "mqtt api returned %d", msg_id);
esp_err_t err = esp_mqtt_client_set_uri(client, "mqtt://localhost:1883");
ESP_LOGI(TAG, "mqtt api returned %d", err);
+3 -3
View File
@@ -53,7 +53,7 @@ TEST(mqtt5, init_and_deinit)
.session.protocol_ver = MQTT_PROTOCOL_V_5,
.credentials.username = "123",
.credentials.authentication.password = "456",
.session.last_will.topic = "/topic/will",
.session.last_will.topic = "topic/will",
.session.last_will.msg = "i will leave",
.session.last_will.msg_len = 12,
.session.last_will.qos = 1,
@@ -70,7 +70,7 @@ TEST(mqtt5, init_and_deinit)
.payload_format_indicator = true,
.message_expiry_interval = 10,
.content_type = "json",
.response_topic = "/test/response",
.response_topic = "test/response",
.correlation_data = "123456",
.correlation_data_len = 6,
};
@@ -110,7 +110,7 @@ TEST(mqtt5, enqueue_and_destroy_outbox)
.payload_format_indicator = 1,
.message_expiry_interval = 1000,
.topic_alias = 0,
.response_topic = "/topic/test/response",
.response_topic = "topic/test/response",
.correlation_data = "123456",
.correlation_data_len = 6,
.content_type = "json",
@@ -158,7 +158,7 @@ bool mqtt5_subscribe_publish(void)
.payload_format_indicator = 1,
.message_expiry_interval = 1000,
.topic_alias = 1,
.response_topic = "/topic/test/response",
.response_topic = "topic/test/response",
.correlation_data = "123456",
.correlation_data_len = 6,
.content_type = "json",
@@ -217,7 +217,7 @@ bool mqtt5_lwt_clean_disconnect(void)
.payload_format_indicator = true,
.message_expiry_interval = 10,
.content_type = "json",
.response_topic = "/test/response",
.response_topic = "test/response",
.correlation_data = "123456",
.correlation_data_len = 6,
};