doido-cable 0.0.4

Action Cable analogue: channels, broadcasts, Turbo-friendly pub/sub backends for Doido.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use doido_core::Result;

pub struct ChannelContext {
    pub identifier: String,
    pub stream: Option<String>,
}

#[async_trait::async_trait]
pub trait Channel: Send + Sync {
    async fn subscribed(&self, ctx: &ChannelContext) -> Result<()>;
    async fn unsubscribed(&self, ctx: &ChannelContext) -> Result<()>;
    async fn received(&self, ctx: &ChannelContext, data: serde_json::Value) -> Result<()>;
}