Skip to main content

WebSocket

Trait WebSocket 

pub trait WebSocket<ClientMsg, ServerMsg>: Sized + 'static
where ClientMsg: Serialize + for<'a> Deserialize<'a> + Send, ServerMsg: Serialize + Debug + for<'a> Deserialize<'a> + Send,
{ const SERVER_ENDPOINT: &'static str; const TIMEOUT: f32 = 10.0; // Provided methods fn force_start_server() { ... } fn force_start_client( handle: impl FnMut(ServerMsg) -> Option<ClientMsg> + Clone + 'static, on_start: impl FnMut(Self) + 'static, ) where Self: WebSocketClient<ClientMsg, ServerMsg> { ... } }

Required Associated Constantsยง

const SERVER_ENDPOINT: &'static str

Provided Associated Constantsยง

const TIMEOUT: f32 = 10.0

Provided Methodsยง

fn force_start_server()

fn force_start_client( handle: impl FnMut(ServerMsg) -> Option<ClientMsg> + Clone + 'static, on_start: impl FnMut(Self) + 'static, )
where Self: WebSocketClient<ClientMsg, ServerMsg>,

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ยง

Sourceยง

impl WebSocket<(usize, TeXMath), (usize, Result<String, String>)> for MathSocket

Sourceยง

const SERVER_ENDPOINT: &'static str = "/ws/mathjx"

Sourceยง

const TIMEOUT: f32 = 10.0

ยง

impl WebSocket<(), Log> for LogSocket

ยง

const SERVER_ENDPOINT: &'static str = "/ws/log"

ยง

impl WebSocket<NonZero<u32>, QueueMessage> for QueueSocket

ยง

const SERVER_ENDPOINT: &'static str = "/ws/queue"