lib3h 0.0.2-alpha1

The lib3h p2p communication rust library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! abstraction for working with Websocket connections
//! TcpStream specific functions

use crate::transport_wss::TransportWss;

impl TransportWss<std::net::TcpStream> {
    /// convenience constructor for creating a websocket "Transport"
    /// instance that is based of the rust std TcpStream
    pub fn with_std_tcp_stream() -> Self {
        TransportWss::new(|uri| {
            let socket = std::net::TcpStream::connect(uri)?;
            socket.set_nonblocking(true)?;
            Ok(socket)
        })
    }
}