Trait RequestHandler

Source
pub trait RequestHandler:
    Send
    + Sync
    + 'static {
    // Required methods
    fn handle_request(
        &self,
        payload: Vec<u8>,
        encoding: &'static str,
    ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send>>;
    fn handle_push(
        &self,
        payload: Vec<u8>,
        encoding: &'static str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send>>;
}
Expand description

Trait implemented by servers for handling individual Requests and Pushes.

Required Methods§

Source

fn handle_request( &self, payload: Vec<u8>, encoding: &'static str, ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send>>

Handle a single request. Return a future with the result.

Source

fn handle_push( &self, payload: Vec<u8>, encoding: &'static str, ) -> Pin<Box<dyn Future<Output = ()> + Send>>

Handle a single push.

Implementors§