use real_async_tls::client::TlsStream; use real_async_tls::TlsConnector; use tungstenite::client::IntoClientRequest; use tungstenite::Error; use crate::stream::Stream as StreamSwitcher; use crate::{Response, WebSocketConfig, WebSocketStream}; use super::TokioAdapter; pub type MaybeTlsStream = StreamSwitcher>; pub type AutoStream = MaybeTlsStream>; pub type Connector = TlsConnector; /// Creates a WebSocket handshake from a request and a stream, /// upgrading the stream to TLS if required and using the given /// connector and WebSocket configuration. pub async fn client_async_tls_with_connector_and_config( request: R, stream: S, connector: Option, config: Option, ) -> Result<(WebSocketStream>, Response), Error> where R: IntoClientRequest + Unpin, S: 'static + tokio::io::AsyncRead + tokio::io::AsyncWrite + Unpin, AutoStream: Unpin, { crate::async_tls::client_async_tls_with_connector_and_config( request, TokioAdapter(stream), connector, config, ) .await }