Skip to main content

WsTransport

Trait WsTransport 

Source
pub trait WsTransport:
    Stream<Item = Result<Message, TransportError>>
    + Sink<Message, Error = TransportError>
    + Send
    + Unpin { }
Expand description

A backend-agnostic, bidirectional WebSocket transport.

This is the trait that the higher layers in nautilus-network (the reconnecting client, the auth tracker, the subscription manager) consume. Each transport backend implements it for its own native stream type.

The trait combines [futures::Stream] for incoming messages and [futures::Sink] for outgoing messages, both keyed off the neutral Message type and the neutral TransportError.

Implementors§

Source§

impl<T> WsTransport for T
where T: Stream<Item = Result<Message, TransportError>> + Sink<Message, Error = TransportError> + Send + Unpin,