pub trait WsWriter:
Send
+ Sync
+ 'static {
// Required methods
fn send(&self, msg: MykoMessage);
fn send_serialized_command(
&self,
tx: Arc<str>,
command_id: String,
payload: EncodedCommandMessage,
);
// Provided methods
fn protocol(&self) -> MykoProtocol { ... }
fn send_report_response(&self, tx: Arc<str>, output: Arc<dyn AnyOutput>) { ... }
fn send_query_response(&self, response: PendingQueryResponse, is_view: bool) { ... }
}Expand description
Trait for sending WebSocket messages.
Implemented by the actual WebSocket writer to allow abstraction and easier testing.
Required Methods§
Sourcefn send(&self, msg: MykoMessage)
fn send(&self, msg: MykoMessage)
Send a message to the client.
Sourcefn send_serialized_command(
&self,
tx: Arc<str>,
command_id: String,
payload: EncodedCommandMessage,
)
fn send_serialized_command( &self, tx: Arc<str>, command_id: String, payload: EncodedCommandMessage, )
Send a pre-serialized command payload while preserving command metadata.
Provided Methods§
Sourcefn protocol(&self) -> MykoProtocol
fn protocol(&self) -> MykoProtocol
Return the writer’s preferred wire protocol for outbound messages.
Sourcefn send_report_response(&self, tx: Arc<str>, output: Arc<dyn AnyOutput>)
fn send_report_response(&self, tx: Arc<str>, output: Arc<dyn AnyOutput>)
Send a report response while allowing implementations to defer expensive serialization/conversion work off the reactive callback path.
Sourcefn send_query_response(&self, response: PendingQueryResponse, is_view: bool)
fn send_query_response(&self, response: PendingQueryResponse, is_view: bool)
Send a query/view response while allowing implementations to defer expensive item-to-JSON conversion off the reactive callback path.