WebSocketClient

Trait WebSocketClient 

pub trait WebSocketClient<ClientMsg, ServerMsg>: WebSocket<ClientMsg, ServerMsg>
where ClientMsg: Serialize + for<'a> Deserialize<'a> + Send, ServerMsg: Serialize + Debug + for<'a> Deserialize<'a> + Send,
{ // Required methods fn new(ws: WebSocket) -> Self; fn socket(&mut self) -> &mut WebSocket; // Provided methods fn send(&mut self, msg: &ClientMsg) { ... } fn callback( ws: &WebSocket, handle: &mut impl FnMut(ServerMsg) -> Option<ClientMsg>, event: MessageEvent, ) { ... } fn start( handle: impl FnMut(ServerMsg) -> Option<ClientMsg> + 'static, ) -> Option<Self> { ... } fn on_open(&self) -> Option<Box<dyn FnMut()>> { ... } }

Required Methods§

fn new(ws: WebSocket) -> Self

fn socket(&mut self) -> &mut WebSocket

Provided Methods§

fn send(&mut self, msg: &ClientMsg)

fn callback( ws: &WebSocket, handle: &mut impl FnMut(ServerMsg) -> Option<ClientMsg>, event: MessageEvent, )

fn start( handle: impl FnMut(ServerMsg) -> Option<ClientMsg> + 'static, ) -> Option<Self>

fn on_open(&self) -> Option<Box<dyn FnMut()>>

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 WebSocketClient<(usize, TeXMath), (usize, Result<String, String>)> for MathSocket

Available on crate feature hydrate only.
§

impl WebSocketClient<(), Log> for LogSocket

Available on crate feature hydrate only.
Source§

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

Available on crate feature hydrate only.