Skip to main content

WebSocketHandler

Trait WebSocketHandler 

Source
pub trait WebSocketHandler: Send + Sync {
    // Required methods
    fn on_message<'life0, 'life1, 'async_trait>(
        &'life0 self,
        conn: &'life1 WebSocketConnection,
        msg: WebSocketMessage,
    ) -> Pin<Box<dyn Future<Output = Result<Option<WebSocketMessage>, WsError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn on_connect<'life0, 'life1, 'async_trait>(
        &'life0 self,
        conn: &'life1 WebSocketConnection,
    ) -> Pin<Box<dyn Future<Output = Result<(), WsError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn on_disconnect<'life0, 'life1, 'async_trait>(
        &'life0 self,
        conn: &'life1 WebSocketConnection,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn authenticate(&self, token: &str) -> Result<i64, WsError>;
}

Required Methods§

Source

fn on_message<'life0, 'life1, 'async_trait>( &'life0 self, conn: &'life1 WebSocketConnection, msg: WebSocketMessage, ) -> Pin<Box<dyn Future<Output = Result<Option<WebSocketMessage>, WsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn on_connect<'life0, 'life1, 'async_trait>( &'life0 self, conn: &'life1 WebSocketConnection, ) -> Pin<Box<dyn Future<Output = Result<(), WsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn on_disconnect<'life0, 'life1, 'async_trait>( &'life0 self, conn: &'life1 WebSocketConnection, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn authenticate(&self, token: &str) -> Result<i64, WsError>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§