Trait workflow_rpc::server::protocol::ProtocolHandler
source · 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 JsonProtocol
protocol handlers
Required Methods§
fn new(methods: Arc<Interface<ServerContext, ConnectionContext, Ops>>) -> Selfwhere
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>
Object Safety§
This trait is not object safe.