pub mod backend;
pub mod channel;
mod hub;
pub mod protocol;
pub use backend::{InMemoryBackend, RelayBackend, TopicReceiver};
pub use channel::{ChannelDescriptor, PresenceEntry, RelayEvent};
pub use hub::{Relay, RelayHub};
#[derive(Debug, Clone)]
pub struct RelayConfig {
pub topic_capacity: usize,
pub max_subscriptions_per_connection: usize,
pub path: String,
}
impl Default for RelayConfig {
fn default() -> Self {
Self {
topic_capacity: 128,
max_subscriptions_per_connection: 50,
path: "/ws".to_owned(),
}
}
}
impl RelayConfig {
pub fn with_path(mut self, path: impl Into<String>) -> Self {
self.path = path.into();
self
}
pub fn with_topic_capacity(mut self, capacity: usize) -> Self {
self.topic_capacity = capacity;
self
}
pub fn with_max_subscriptions(mut self, max: usize) -> Self {
self.max_subscriptions_per_connection = max;
self
}
}