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§

source

fn connect(&mut self, client: ClientId)

Called each time a client connects to the service.

source

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.

source

fn message(&mut self, client: ClientId, message: &str)

Called each time a client sends a text message to the service.

source

fn binary(&mut self, client: ClientId, message: &[u8])

Called each time a client sends a binary message to the service.

source

fn timer(&mut self)

Called when StateroomContext::set_timer has been called on this service’s context, after the provided duration.

Implementors§