Skip to main content

doido_cable/
channel.rs

1use doido_core::Result;
2
3pub struct ChannelContext {
4    pub identifier: String,
5    pub stream: Option<String>,
6}
7
8#[async_trait::async_trait]
9pub trait Channel: Send + Sync {
10    async fn subscribed(&self, ctx: &ChannelContext) -> Result<()>;
11    async fn unsubscribed(&self, ctx: &ChannelContext) -> Result<()>;
12    async fn received(&self, ctx: &ChannelContext, data: serde_json::Value) -> Result<()>;
13}