snapview / tokio-tungstenite

Future-based Tungstenite for Tokio. Lightweight stream-based WebSocket implementation
MIT License
1.88k stars 236 forks source link

IO error: invalid peer certificate contents: invalid peer certificate: UnknownIssuer #265

Closed rosejober closed 1 year ago

rosejober commented 1 year ago

When I use tokio-tungstenite for websocket connection, features specify rustls-tls-webpki-roots. On some computers, there is an error in the title. This error seems to be due to the fact that set_certificate_verifier is not set in tls. Can it be fixed?

daniel-abramov commented 1 year ago

You have full control over which TLS connections are accepted and which are not. We're very flexible in that regard, i.e. check the TLS functions of tokio-tungstenite. Many of them do allow specifying a custom Connector if that's what you want, e.g. connect_async_tls_with_config.

rosejober commented 1 year ago

You have full control over which TLS connections are accepted and which are not. We're very flexible in that regard, i.e. check the TLS functions of tokio-tungstenite. Many of them do allow specifying a custom Connector if that's what you want, e.g. connect_async_tls_with_config.

It is recommended to add a parameter in WebSocketConfig to control whether to accept invalid certificates, just like the reqwest library.