pub trait EventHandler {
    type ClientUserData: Default + Send + Sync;

    // Required method
    fn on_request(
        &self,
        peer: &mut PeerContext<Self::ClientUserData>,
        request: Value
    ) -> impl Future<Output = Result<Value>> + Send;

    // Provided methods
    fn on_connect(
        &self,
        _id: u64
    ) -> impl Future<Output = Result<Self::ClientUserData>> + Send { ... }
    fn on_disconnect(&self, _id: u64) -> impl Future<Output = ()> + Send { ... }
}

Required Associated Types§

Required Methods§

source

fn on_request( &self, peer: &mut PeerContext<Self::ClientUserData>, request: Value ) -> impl Future<Output = Result<Value>> + Send

Provided Methods§

source

fn on_connect( &self, _id: u64 ) -> impl Future<Output = Result<Self::ClientUserData>> + Send

source

fn on_disconnect(&self, _id: u64) -> impl Future<Output = ()> + Send

Object Safety§

This trait is not object safe.

Implementors§