Trait WebSocketServer

Source
pub trait WebSocketServer<ClientMsg: Serialize + for<'a> Deserialize<'a> + Send, ServerMsg: Serialize + Debug + for<'a> Deserialize<'a> + Send>: WebSocket<ClientMsg, ServerMsg> {
    // Required methods
    fn new<'async_trait>(
        account: LoginState,
        db: DBBackend,
    ) -> Pin<Box<dyn Future<Output = Option<Self>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn next<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Option<ServerMsg>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn handle_message<'life0, 'async_trait>(
        &'life0 mut self,
        msg: ClientMsg,
    ) -> Pin<Box<dyn Future<Output = Option<ServerMsg>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn on_start<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _socket: &'life1 mut WebSocket,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn ws_handler<'async_trait>(
        auth_session: AuthSession<DBBackend>,
        ws: WebSocketUpgrade,
    ) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
       where Self: Send + Send + 'async_trait { ... }
    fn on_upgrade<'async_trait>(
        self,
        socket: WebSocket,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: Send + Send + 'async_trait { ... }
}

Required Methods§

Source

fn new<'async_trait>( account: LoginState, db: DBBackend, ) -> Pin<Box<dyn Future<Output = Option<Self>> + Send + 'async_trait>>
where Self: 'async_trait,

Source

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

Source

fn handle_message<'life0, 'async_trait>( &'life0 mut self, msg: ClientMsg, ) -> Pin<Box<dyn Future<Output = Option<ServerMsg>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn on_start<'life0, 'life1, 'async_trait>( &'life0 mut self, _socket: &'life1 mut WebSocket, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn ws_handler<'async_trait>( auth_session: AuthSession<DBBackend>, ws: WebSocketUpgrade, ) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
where Self: Send + Send + 'async_trait,

Source

fn on_upgrade<'async_trait>( self, socket: WebSocket, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Send + Send + 'async_trait,

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.

Implementors§