Skip to main content

WsWriter

Trait WsWriter 

Source
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§

Source

fn send(&self, msg: MykoMessage)

Send a message to the client.

Source

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§

Source

fn protocol(&self) -> MykoProtocol

Return the writer’s preferred wire protocol for outbound messages.

Source

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.

Source

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.

Implementors§