Skip to main content

doido_cable/
cable.rs

1use crate::pubsub::PubSub;
2use doido_core::Result;
3use std::sync::Arc;
4
5pub struct Cable {
6    pubsub: Arc<dyn PubSub>,
7}
8
9impl Cable {
10    pub fn new(pubsub: Arc<dyn PubSub>) -> Self {
11        Self { pubsub }
12    }
13
14    pub async fn broadcast_to(&self, stream: &str, message: &str) -> Result<()> {
15        self.pubsub.publish(stream, message).await
16    }
17}