Skip to main content

StreamHandler

Trait StreamHandler 

Source
pub trait StreamHandler: Send + Sync {
    // Required methods
    fn publish<'life0, 'async_trait>(
        &'life0 self,
        event: StreamEvent,
    ) -> Pin<Box<dyn Future<Output = CiabResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sandbox_id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = CiabResult<Receiver<StreamEvent>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn subscribe_with_replay<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        sandbox_id: &'life1 Uuid,
        last_event_id: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = CiabResult<(Vec<StreamEvent>, Receiver<StreamEvent>)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn unsubscribe<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sandbox_id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = CiabResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn publish<'life0, 'async_trait>( &'life0 self, event: StreamEvent, ) -> Pin<Box<dyn Future<Output = CiabResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Publish an event for a sandbox.

Source

fn subscribe<'life0, 'life1, 'async_trait>( &'life0 self, sandbox_id: &'life1 Uuid, ) -> Pin<Box<dyn Future<Output = CiabResult<Receiver<StreamEvent>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Subscribe to events for a sandbox, returning a broadcast receiver.

Source

fn subscribe_with_replay<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, sandbox_id: &'life1 Uuid, last_event_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = CiabResult<(Vec<StreamEvent>, Receiver<StreamEvent>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Subscribe to events and replay buffered events for reconnection support. Returns (replayed_events, live_receiver).

When last_event_id is provided, replays events after that ID. When None, replays the entire buffer so reconnecting clients catch up.

Source

fn unsubscribe<'life0, 'life1, 'async_trait>( &'life0 self, sandbox_id: &'life1 Uuid, ) -> Pin<Box<dyn Future<Output = CiabResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Unsubscribe / clean up resources for a sandbox stream.

Implementors§