elif_http/websocket/channel/mod.rs
1//! Channel abstraction system for WebSocket messaging
2//!
3//! This module provides channel-based messaging capabilities, allowing connections
4//! to join/leave channels and enabling targeted message broadcasting to channel members.
5//!
6//! ## Architecture
7//!
8//! The channel system is organized into several logical modules:
9//!
10//! - [`types`] - Core types and data structures
11//! - [`channel`] - Individual channel implementation
12//! - [`manager`] - Channel lifecycle and management
13//! - [`message`] - Channel message types
14//! - [`events`] - Event system for channel operations
15//!
16//! ## Quick Start
17//!
18//! ```rust
19//! use elif_http::websocket::{ChannelManager, ChannelType, ConnectionId};
20//!
21//! #[tokio::main]
22//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
23//! let manager = ChannelManager::new();
24//! let creator_id = ConnectionId::new();
25//! let joiner_id = ConnectionId::new();
26//!
27//! // Create a public channel
28//! let channel_id = manager.create_channel(
29//! "general".to_string(),
30//! ChannelType::Public,
31//! Some(creator_id),
32//! ).await?;
33//!
34//! // Join the channel with a different connection
35//! manager.join_channel(
36//! channel_id,
37//! joiner_id,
38//! None, // No password needed for public channels
39//! Some("Alice".to_string()),
40//! ).await?;
41//!
42//! Ok(())
43//! }
44//! ```
45
46pub mod channel;
47pub mod events;
48pub mod manager;
49pub mod message;
50pub mod password;
51pub mod types;
52
53#[cfg(test)]
54mod tests;
55
56// Re-export main types for convenience
57pub use channel::Channel;
58pub use events::ChannelEvent;
59pub use manager::ChannelManager;
60pub use message::ChannelMessage;
61pub use types::{
62 ChannelId, ChannelManagerStats, ChannelMember, ChannelMetadata, ChannelPermissions,
63 ChannelStats, ChannelType,
64};