[][src]Struct websocket_rs::Websocket

pub struct Websocket<S> { /* fields omitted */ }

Implementations

impl<S: 'static> Websocket<S> where
    S: AsyncRead + AsyncWrite + Unpin + Send
[src]

pub fn new(stream: S) -> Self[src]

Create a new websocket instance, given any type that implements AsyncRead + AsyncWrite like tokio::net::TcpStream or tokio_native_tls::TlsStream

pub fn new_with_key(stream: S, key: String) -> Self[src]

Same as Websocket::new except that it also accept a key that represent the value of Sec-Websocket-Key for client that requires a valid Sec-Websocket-Accept in response headers.

pub async fn next<'_>(&'_ mut self) -> Option<Message>[src]

Wait for next frame to come. (support incoming fragmented frames)

pub async fn send_text<'_, T: AsRef<str>>(
    &'_ mut self,
    t: T
) -> WebsocketResult<()>
[src]

Send a text frame

Trait Implementations

impl<S: Debug> Debug for Websocket<S>[src]

Auto Trait Implementations

impl<S> !RefUnwindSafe for Websocket<S>

impl<S> Send for Websocket<S> where
    S: Send

impl<S> Sync for Websocket<S> where
    S: Sync

impl<S> Unpin for Websocket<S>

impl<S> !UnwindSafe for Websocket<S>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithSubscriber for T[src]