Skip to main content

Realtime

Trait Realtime 

Source
pub trait Realtime: Send + Sync {
    // Required methods
    fn broadcast<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        room_id: &'life1 str,
        message: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), RealtimeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn members<'life0, 'life1, 'async_trait>(
        &'life0 self,
        room_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Member>, RealtimeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Poke a room from outside a socket — a module’s HTTP handler (e.g. an admin ends a session) or a cron. The socket lifecycle itself is the runtime’s job (it calls RoomHandler); this is the part a module holds via Ports.

Required Methods§

Source

fn broadcast<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, room_id: &'life1 str, message: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), RealtimeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send message to every socket in room_id.

Source

fn members<'life0, 'life1, 'async_trait>( &'life0 self, room_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Member>, RealtimeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The members currently connected to room_id.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§