pub trait WsMessageHandle<Msg, E> {
    // Required methods
    fn message_into_kind(msg: Msg) -> WsMessageKind;
    fn error_into_kind(e: E) -> WsErrorKind;
    fn message_from_bytes<T: Into<Vec<u8>>>(bytes: T) -> Msg;

    // Provided method
    fn wrap_stream<S>(inner: S) -> WsByteStream<S, Msg, E, Self>
       where S: Stream<Item = Result<Msg, E>> + Sink<Msg, Error = E> + Unpin { ... }
}
Expand description

Classify messages and errors of WebSocket.

Required Methods§

source

fn message_into_kind(msg: Msg) -> WsMessageKind

source

fn error_into_kind(e: E) -> WsErrorKind

source

fn message_from_bytes<T: Into<Vec<u8>>>(bytes: T) -> Msg

These bytes will be carried by the Msg and sent by the underlying stream.

Provided Methods§

source

fn wrap_stream<S>(inner: S) -> WsByteStream<S, Msg, E, Self>where S: Stream<Item = Result<Msg, E>> + Sink<Msg, Error = E> + Unpin,

Object Safety§

This trait is not object safe.

Implementors§

source§

impl WsMessageHandle<Message, WebSocketError> for stream_ws::gloo::WsMessageHandler

Available on crate feature gloo only.
source§

impl WsMessageHandle<Message, Error> for stream_ws::tungstenite::WsMessageHandler

Available on crate feature tungstenite only.