pub trait ServerHandler: Send {
    type Request;
    type Response;
    type LocalData: Send;

    fn on_request<'life0, 'async_trait>(
        &'life0 self,
        ctx: ServerCtx<Self::Request, Self::Response, Self::LocalData>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn on_accept<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: ConnectionCtx<'life1, Self::LocalData>
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: Sync + 'async_trait
, { ... } }
Expand description

Interface for a handler that receives connections and requests

Required Associated Types

Type of data received by the server

Type of data sent back by the server

Type of data to store locally tied to the specific connection

Required Methods

Invoked upon receiving a request from a client. The server should process this request, which can be found in ctx, and send one or more replies in response.

Provided Methods

Invoked upon a new connection becoming established.

Note

This can be useful in performing some additional initialization on the connection’s local data prior to it being used anywhere else.

Implementors