pub trait WsStreamTrait<E> {
type Stream: Stream<Item = Result<Packet, StreamError<E>>> + Sink<Packet, Error = StreamError<E>> + Unpin + Sized;
// Required method
fn connect(
url: &str,
) -> Pin<Box<dyn Future<Output = Result<Self::Stream, E>> + '_>>;
}Expand description
Trait of helper objects to connect bilibili websocket server.
This trait is used when constructing normal bililive streams or auto-retry bililive streams.
An implementation of WsStreamTrait takes in a ws server url and decodes the data into a stream
of Packet with heartbeat auto-response mechanism implemented
(see HeartbeatStream for details).
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.