mc_core

Trait WebSocketInterface

Source
pub trait WebSocketInterface:
    Send
    + Sync
    + 'static {
    // Required methods
    fn build_init_message(&self) -> impl Future<Output = Result<Vec<u8>>> + Send;
    fn on_message(
        &self,
        address: &str,
        message: &[u8],
    ) -> impl Future<Output = Result<()>> + Send;
}
Expand description

WebSocket interface trait for UIs and Monitors.

Required Methods§

Source

fn build_init_message(&self) -> impl Future<Output = Result<Vec<u8>>> + Send

Build initialization message for newly connecting client.

§Returns

impl Future<Output = Result<Vec<u8>>> + Send

Source

fn on_message( &self, address: &str, message: &[u8], ) -> impl Future<Output = Result<()>> + Send

Handle incoming message from a client.

§Arguments
  • address - address of the client
  • message - message to handle
§Returns

impl Future<Output = Result<()>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§