pub trait ProtocolHandler<ServerContext, ConnectionContext, Ops>: DowncastSync + Sized + Send + Syncwhere
    Ops: OpsT,
    ServerContext: Clone + Send + Sync + 'static,
    ConnectionContext: Clone + Send + Sync + 'static,{
    // Required methods
    fn new(
        methods: Arc<Interface<ServerContext, ConnectionContext, Ops>>
    ) -> Self
       where Self: Sized;
    fn encoding(&self) -> Encoding;
    fn handle_message<'life0, 'life1, 'async_trait>(
        &'life0 self,
        connection_ctx: ConnectionContext,
        message: Message,
        sink: &'life1 WebSocketSink
    ) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn serialize_notification_message<Msg>(
        &self,
        op: Ops,
        msg: Msg
    ) -> Result<Message>
       where Msg: BorshSerialize + Serialize + Send + Sync + 'static;
}
Expand description

Base trait for BorshProtocol and SerdeJsonProtocol protocol handlers

Required Methods§

source

fn new(methods: Arc<Interface<ServerContext, ConnectionContext, Ops>>) -> Selfwhere Self: Sized,

source

fn encoding(&self) -> Encoding

source

fn handle_message<'life0, 'life1, 'async_trait>( &'life0 self, connection_ctx: ConnectionContext, message: Message, sink: &'life1 WebSocketSink ) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn serialize_notification_message<Msg>( &self, op: Ops, msg: Msg ) -> Result<Message>where Msg: BorshSerialize + Serialize + Send + Sync + 'static,

Implementors§

source§

impl<ServerContext, ConnectionContext, Ops, Id> ProtocolHandler<ServerContext, ConnectionContext, Ops> for BorshProtocol<ServerContext, ConnectionContext, Ops, Id>where ServerContext: Clone + Send + Sync + 'static, ConnectionContext: Clone + Send + Sync + 'static, Ops: OpsT, Id: IdT,

source§

impl<ServerContext, ConnectionContext, Ops, Id> ProtocolHandler<ServerContext, ConnectionContext, Ops> for SerdeJsonProtocol<ServerContext, ConnectionContext, Ops, Id>where ServerContext: Clone + Send + Sync + 'static, ConnectionContext: Clone + Send + Sync + 'static, Ops: OpsT, Id: IdT,