pub mod cable;
pub mod channel;
pub mod config;
pub mod connection;
#[cfg(feature = "cable-db")]
pub mod db_pubsub;
pub mod heartbeat;
pub mod protocol;
pub mod pubsub;
#[cfg(feature = "cable-redis")]
pub mod redis_pubsub;
pub mod server;
pub mod streams;
pub use cable::Cable;
pub use channel::{Channel, ChannelContext, ChannelName};
pub use config::{build_configured_pubsub, CableConfig};
pub use connection::CableConnection;
pub use server::{handle_socket, route as cable_route, ws_handler, ChannelRegistry};
pub async fn pubsub_from_config() -> doido_core::Result<std::sync::Arc<dyn PubSub>> {
build_configured_pubsub(&config::load()).await
}
#[cfg(feature = "cable-db")]
pub use db_pubsub::DbPubSub;
pub use doido_cable_macros::channel;
pub use doido_cable_macros::channel as channel_macro;
pub use protocol::{CableFrame, ServerFrame, ServerMessage};
pub use pubsub::{MemoryPubSub, PubSub};
#[cfg(feature = "cable-redis")]
pub use redis_pubsub::RedisPubSub;
#[macro_export]
macro_rules! cable {
($pubsub:expr, [ $($channel:expr),* $(,)? ]) => {{
let mut __registry = $crate::server::ChannelRegistry::new($pubsub);
$( __registry.register_channel($channel); )*
$crate::server::route(::std::sync::Arc::new(__registry))
}};
($pubsub:expr, [ $($channel:expr),* $(,)? ], heartbeat = $heartbeat:expr) => {{
let mut __registry =
$crate::server::ChannelRegistry::new($pubsub).with_heartbeat($heartbeat);
$( __registry.register_channel($channel); )*
$crate::server::route(::std::sync::Arc::new(__registry))
}};
}