Skip to main content

PushSource

Trait PushSource 

Source
pub trait PushSource: Send + 'static {
    // Required method
    fn subscribe(
        &mut self,
        enable: &WebSocketPushEnable,
    ) -> BoxStream<'static, WsStateChange>;
}
Available on crate feature server only.
Expand description

Where a connection’s push notifications come from (RFC 8887 §4.3.5).

One value serves one connection, so it may be scoped to the connection’s caller: it must yield only changes that caller may see.

Required Methods§

Source

fn subscribe( &mut self, enable: &WebSocketPushEnable, ) -> BoxStream<'static, WsStateChange>

Start a subscription for enable: yield every later state change, and first, when enable.push_state is a token this source issued, the changes since it (“the server SHOULD immediately send all changes since that state token”, §4.3.5.2).

The source may skip types outside enable.data_types; the driver cuts every notification to them anyway. A stream that ends turns push off for the connection.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§