snapview / tokio-tungstenite

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

New API `connect_to_raw_socket_async` for raw socket. #245

Closed ssrlive closed 2 years ago

ssrlive commented 2 years ago

use the exiist raw stream socket make it act as WebSocket client. likes

    let url = "ws://123.45.67.89:1234/my_path";
    let stream = tokio::net::TcpStream::connect(("123.45.67.89", 1234)).await?;
    let (ws_stream, _) = connect_to_raw_socket_async(url, None, stream).await?;
    ...