Trait stateroom::StateroomService
source · pub trait StateroomService {
// Provided methods
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
The host interface to a Stateroom service. Implementations should instead implement the trait SimpleStateroomService.
Provided Methods§
sourcefn 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.
sourcefn message(&mut self, client: ClientId, message: &str)
fn message(&mut self, client: ClientId, message: &str)
Called each time a client sends a text message to the service.
sourcefn binary(&mut self, client: ClientId, message: &[u8])
fn binary(&mut self, client: ClientId, message: &[u8])
Called each time a client sends a binary message to the service.
sourcefn timer(&mut self)
fn timer(&mut self)
Called when StateroomContext::set_timer has been called on this service’s context, after the provided duration.