Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket client library cannot handle path setting (IDFGH-1643) #3892

Closed
fordosg opened this issue Aug 7, 2019 · 0 comments
Closed

Websocket client library cannot handle path setting (IDFGH-1643) #3892

fordosg opened this issue Aug 7, 2019 · 0 comments

Comments

@fordosg
Copy link

fordosg commented Aug 7, 2019

Environment

  • IDF version: v4.0-dev-1381-g6fe853a2c

Problem Description

Hi all,

The new Websockets library does not use the path configuration variable, if I not using the uri scheme.

Initialization code:

esp_websocket_client_config_t ws_conf = {
		.host = URL,
		.port = PORT,
		.path = path,
		.buffer_size = 512,
		.transport = WEBSOCKET_TRANSPORT_OVER_SSL,
};

Working solution: set path for transport before intialization

Current code (components/esp_websocket_client/esp_websocket_client.c; from line 430):

if (client->transport == NULL) {
                    ESP_LOGE(TAG, "There are no transport");
                    client->run = false;
                    break;
                }

                if (esp_transport_connect(client->transport,
                                          client->config->host,
                                          client->config->port,
                                          client->config->network_timeout_ms) < 0) {
                    ESP_LOGE(TAG, "Error transport connect");
                    esp_websocket_client_abort_connection(client);
                    break;
                }

Working code:

if (client->transport == NULL) {
                    ESP_LOGE(TAG, "There are no transport");
                    client->run = false;
                    break;
                }

		esp_transport_ws_set_path(client->transport, client->config->path);

                if (esp_transport_connect(client->transport,
                                          client->config->host,
                                          client->config->port,
                                          client->config->network_timeout_ms) < 0) {
                    ESP_LOGE(TAG, "Error transport connect");
                    esp_websocket_client_abort_connection(client);
                    break;
                }```

Regards,
@github-actions github-actions bot changed the title Websocket client library cannot handle path setting Websocket client library cannot handle path setting (IDFGH-1643) Aug 7, 2019
@igrr igrr closed this as completed in c0ba9e1 Oct 13, 2019
espressif-bot pushed a commit that referenced this issue Nov 19, 2019
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue Apr 8, 2022
euripedesrocha pushed a commit to euripedesrocha/esp-protocols that referenced this issue Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant