websocket_example.c WSS
Posted: Tue Sep 14, 2021 5:07 pm
The websocket_example.c fails on esp32 when we try to connect to a secure WSS socket.
I have enabled the default certificate bundle in sdkconfig, and set transport to SSL in the config, but still no luck.
How to get the websocket client to use the certificate bundle?
The debug trace is below:
I (2090) esp_netif_handlers: example_connect: sta ip: 192.168.0.16, mask: 255.255.255.0, gw: 192.168.0.1
I (2090) example_connect: Got IPv4 event: Interface "example_connect: sta" address: 192.168.0.16
I (2590) example_connect: Got IPv6 event: Interface "example_connect: sta" address: fe80:0000:0000:0000:e2e2:e6ff:fee4:b4bc, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (2590) example_connect: Connected to example_connect: sta
I (2600) example_connect: - IPv4 address: 192.168.0.16
I (2600) example_connect: - IPv6 address: fe80:0000:0000:0000:e2e2:e6ff:fee4:b4bc, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (2620) WEBSOCKET: Connecting to wss://demo.piesocket.com/v3/channel_1?api_key=oCdCMcMPQpbvNjUIzqtvF1d2X2okWpDQj4AwARJuAgtjhzKxVEjQU6IdCjwm¬ify_self...
E (2730) esp-tls-mbedtls: No server verification option set in esp_tls_cfg_t structure. Check esp_tls API reference
E (2730) esp-tls-mbedtls: Failed to set client configurations
E (2740) esp-tls: create_ssl_handle failed
E (2740) esp-tls: Failed to open new connection
E (2750) TRANS_SSL: Failed to open a new connection
E (2760) TRANSPORT_WS: Error connecting to host demo.piesocket.com:443
E (2760) WEBSOCKET_CLIENT: Error transport connect
I (2770) WEBSOCKET_CLIENT: Reconnect after 10000 ms
I (2770) WEBSOCKET: WEBSOCKET_EVENT_DISCONNECTED
I have enabled the default certificate bundle in sdkconfig, and set transport to SSL in the config, but still no luck.
How to get the websocket client to use the certificate bundle?
The debug trace is below:
I (2090) esp_netif_handlers: example_connect: sta ip: 192.168.0.16, mask: 255.255.255.0, gw: 192.168.0.1
I (2090) example_connect: Got IPv4 event: Interface "example_connect: sta" address: 192.168.0.16
I (2590) example_connect: Got IPv6 event: Interface "example_connect: sta" address: fe80:0000:0000:0000:e2e2:e6ff:fee4:b4bc, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (2590) example_connect: Connected to example_connect: sta
I (2600) example_connect: - IPv4 address: 192.168.0.16
I (2600) example_connect: - IPv6 address: fe80:0000:0000:0000:e2e2:e6ff:fee4:b4bc, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (2620) WEBSOCKET: Connecting to wss://demo.piesocket.com/v3/channel_1?api_key=oCdCMcMPQpbvNjUIzqtvF1d2X2okWpDQj4AwARJuAgtjhzKxVEjQU6IdCjwm¬ify_self...
E (2730) esp-tls-mbedtls: No server verification option set in esp_tls_cfg_t structure. Check esp_tls API reference
E (2730) esp-tls-mbedtls: Failed to set client configurations
E (2740) esp-tls: create_ssl_handle failed
E (2740) esp-tls: Failed to open new connection
E (2750) TRANS_SSL: Failed to open a new connection
E (2760) TRANSPORT_WS: Error connecting to host demo.piesocket.com:443
E (2760) WEBSOCKET_CLIENT: Error transport connect
I (2770) WEBSOCKET_CLIENT: Reconnect after 10000 ms
I (2770) WEBSOCKET: WEBSOCKET_EVENT_DISCONNECTED