Skip to main content

RoomOps

Trait RoomOps 

Source
pub trait RoomOps: Send + Sync {
    // Required methods
    fn join(
        &self,
        room: &str,
        user_id: &str,
        data: Option<Value>,
    ) -> Result<(Value, Value), DataError>;
    fn leave(&self, room: &str, user_id: &str) -> Option<Value>;
    fn set_presence(
        &self,
        room: &str,
        user_id: &str,
        data: Value,
    ) -> Option<Value>;
    fn broadcast(
        &self,
        room: &str,
        sender: Option<&str>,
        topic: &str,
        data: Value,
    ) -> Option<Value>;
    fn list_rooms(&self) -> Vec<String>;
    fn room_size(&self, name: &str) -> usize;
    fn members(&self, name: &str) -> Vec<Value>;
}
Expand description

Room operations used by the router.

Required Methods§

Source

fn join( &self, room: &str, user_id: &str, data: Option<Value>, ) -> Result<(Value, Value), DataError>

Source

fn leave(&self, room: &str, user_id: &str) -> Option<Value>

Source

fn set_presence(&self, room: &str, user_id: &str, data: Value) -> Option<Value>

Source

fn broadcast( &self, room: &str, sender: Option<&str>, topic: &str, data: Value, ) -> Option<Value>

Source

fn list_rooms(&self) -> Vec<String>

Source

fn room_size(&self, name: &str) -> usize

Source

fn members(&self, name: &str) -> Vec<Value>

Implementors§