From 2f74b409f78d2c6db8a44d51082669dc365eb6d5 Mon Sep 17 00:00:00 2001 From: Liu Han Date: Mon, 10 Jun 2019 09:26:04 +0800 Subject: [PATCH] fix(mqtt): Fix a bug of MQTT when disable WS or WSS --- components/mqtt/esp-mqtt/mqtt_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/mqtt/esp-mqtt/mqtt_client.c b/components/mqtt/esp-mqtt/mqtt_client.c index 7ee01261..9768f72d 100644 --- a/components/mqtt/esp-mqtt/mqtt_client.c +++ b/components/mqtt/esp-mqtt/mqtt_client.c @@ -406,6 +406,7 @@ esp_err_t esp_mqtt_client_set_uri(esp_mqtt_client_handle_t client, const char *u client->config->path = create_string(uri + puri.field_data[UF_PATH].off, puri.field_data[UF_PATH].len); } if (client->config->path) { +#if MQTT_ENABLE_WSS || MQTT_ENABLE_WS esp_transport_handle_t trans = esp_transport_list_get_transport(client->transport_list, "ws"); if (trans) { esp_transport_ws_set_path(trans, client->config->path); @@ -414,6 +415,7 @@ esp_err_t esp_mqtt_client_set_uri(esp_mqtt_client_handle_t client, const char *u if (trans) { esp_transport_ws_set_path(trans, client->config->path); } +#endif } if (puri.field_data[UF_PORT].len) {