pub trait MessageWriter: Send + Sync {
// Required methods
fn broadcast(
&self,
content: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>;
fn reply_to(
&self,
username: &str,
content: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>;
fn emit_event(
&self,
event_type: EventType,
content: &str,
params: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>;
}Expand description
Async message dispatch for plugins. Abstracts over the broker’s broadcast and persistence machinery so plugins never touch broker internals.
The broker provides a concrete implementation; external crates only see this trait.
Required Methods§
Sourcefn broadcast(
&self,
content: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>
fn broadcast( &self, content: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>
Broadcast a system message to all connected clients and persist to history.