Skip to main content

HandshakeMiddleware

Trait HandshakeMiddleware 

Source
pub trait HandshakeMiddleware: Send + Sync {
    // Required method
    fn handle<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        socket: &'life1 SocketRef,
        container: &'life2 Container,
    ) -> Pin<Box<dyn Future<Output = SocketResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Runs at handshake, before any event is wired.

The socket is available, so a middleware can read the handshake auth payload or headers; the container is the connection’s own, so what it registers is visible to every handler on that socket.

Returning Err refuses the connection.

Required Methods§

Source

fn handle<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, socket: &'life1 SocketRef, container: &'life2 Container, ) -> Pin<Box<dyn Future<Output = SocketResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§