Trait ExchangeHandler

Source
pub trait ExchangeHandler: MessageHandler {
    // Required methods
    fn exchange(&self) -> Exchange;
    fn get_subscriptions<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = WebSocketResult<Vec<Message>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn authenticate<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = WebSocketResult<Option<Message>>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn requires_auth(&self) -> bool { ... }
    fn get_heartbeat(&self) -> Option<Message> { ... }
    fn heartbeat_interval(&self) -> Option<Duration> { ... }
}
Expand description

Exchange-specific handler trait

Required Methods§

Source

fn exchange(&self) -> Exchange

Get the exchange type

Source

fn get_subscriptions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = WebSocketResult<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get subscription messages

Provided Methods§

Source

fn authenticate<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = WebSocketResult<Option<Message>>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Handle authentication if required

Source

fn requires_auth(&self) -> bool

Check if the connection needs authentication

Source

fn get_heartbeat(&self) -> Option<Message>

Get heartbeat message if required

Source

fn heartbeat_interval(&self) -> Option<Duration>

Get heartbeat interval

Implementors§