Trait jamsocket_wasm::prelude::JamsocketService [−][src]
pub trait JamsocketService: 'static + Send + Sync + Unpin {
fn connect(&mut self, client: ClientId);
fn disconnect(&mut self, client: ClientId);
fn message(&mut self, client: ClientId, message: &str);
fn binary(&mut self, client: ClientId, message: &[u8]);
fn timer(&mut self);
}
Expand description
Re-exports useful items from jamsocket
and jamsocket_wasm_macro
.
The host interface to a Jamsocket service. Implementations should instead implement the trait
SimpleJamsocketService.
Required methods
fn disconnect(&mut self, client: ClientId)
fn disconnect(&mut self, client: ClientId)
Called each time a client disconnects from the service, unless that disconnection will cause the service to be destroyed.
Called each time a client sends a text message to the service.
Called each time a client sends a binary message to the service.
Called when JamsocketContext::set_timer has been called on this service’s context, after the provided duration.