-
Notifications
You must be signed in to change notification settings - Fork 183
Description
Answers checklist.
- I have read the documentation for esp-protocols components and the issue is not addressed there.
- I have updated my esp-protocols branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
General issue report
I am using ESP-IDF 5.5.1 with esp_websocket_client v1.6.0 to connect to coze.cn (an AI voice agent). The connection is successfully established, and voice calls work normally. However, the connection drops every ~1 minute with errors.
I have consulted Coze's server team, and they confirmed that the server does not actively close connections. Additionally, I have logged the WebSocket Ping/Pong frames, and they appear normal (no missing/failed frames).
E (383448) esp-tls-mbedtls: write error :-0x6C00
E (383448) transport_base: esp_tls_conn_write error, errno=Success
E (383449) transport_ws: Error write header
E (383452) websocket_client: esp_transport_write() returned -1, transport_error=ESP_ERR_MBEDTLS_SSL_WRITE_FAILED, tls_error_code=27648, tls_flags=0, errno=0
E (383465) websocket_coz_chat: event 0 websocket_event_handler error
char *combined_headers = user_malloc(128);
char *temp_uri = user_malloc(128);
sprintf(combined_headers,"Authorization: bearer %s\r\n",coz_key);
sprintf(temp_uri,"/v1/chat?bot_id=%s",coz_bot);
esp_websocket_client_config_t ws_cfg = {
.uri = temp_uri,
.host = "ws.coze.cn",
.port = 443,
.transport = WEBSOCKET_TRANSPORT_OVER_SSL,
.cert_pem = NULL,
.reconnect_timeout_ms = 500,
.network_timeout_ms = 10*1000,
.buffer_size = 4096,
.skip_cert_common_name_check = false,
.headers = combined_headers,
.keep_alive_enable = true,
.crt_bundle_attach = esp_crt_bundle_attach,
};
ws_client = esp_websocket_client_init(&ws_cfg);
user_free(combined_headers);
user_free(temp_uri);
esp_websocket_register_events(ws_client, WEBSOCKET_EVENT_ANY, websocket_event_handler, NULL);
esp_websocket_client_start(ws_client);