pub struct BroadcastConfig {
pub max_subscribers_per_channel: usize,
pub max_channels: usize,
pub heartbeat_interval: Duration,
pub client_timeout: Duration,
pub allow_client_events: bool,
}Expand description
Configuration for the broadcaster.
Fields§
§max_subscribers_per_channel: usizeMaximum subscribers per channel (0 = unlimited).
max_channels: usizeMaximum channels (0 = unlimited).
heartbeat_interval: DurationHeartbeat interval for WebSocket connections.
client_timeout: DurationClient timeout (disconnect if no activity).
allow_client_events: boolWhether to allow client-to-client messages (whisper).
Implementations§
Source§impl BroadcastConfig
impl BroadcastConfig
Sourcepub fn new() -> BroadcastConfig
pub fn new() -> BroadcastConfig
Create a new broadcast config with defaults.
Sourcepub fn from_env() -> BroadcastConfig
pub fn from_env() -> BroadcastConfig
Create configuration from environment variables.
Reads the following environment variables:
BROADCAST_MAX_SUBSCRIBERS: Max subscribers per channel (default: unlimited)BROADCAST_MAX_CHANNELS: Max total channels (default: unlimited)BROADCAST_HEARTBEAT_INTERVAL: Heartbeat interval in seconds (default: 30)BROADCAST_CLIENT_TIMEOUT: Client timeout in seconds (default: 60)BROADCAST_ALLOW_CLIENT_EVENTS: Allow whisper messages (default: true)
§Example
ⓘ
use ferro_broadcast::BroadcastConfig;
let config = BroadcastConfig::from_env();
let broadcaster = Broadcaster::with_config(config);Sourcepub fn max_subscribers_per_channel(self, max: usize) -> BroadcastConfig
pub fn max_subscribers_per_channel(self, max: usize) -> BroadcastConfig
Set maximum subscribers per channel.
Sourcepub fn max_channels(self, max: usize) -> BroadcastConfig
pub fn max_channels(self, max: usize) -> BroadcastConfig
Set maximum channels.
Sourcepub fn heartbeat_interval(self, interval: Duration) -> BroadcastConfig
pub fn heartbeat_interval(self, interval: Duration) -> BroadcastConfig
Set heartbeat interval.
Sourcepub fn client_timeout(self, timeout: Duration) -> BroadcastConfig
pub fn client_timeout(self, timeout: Duration) -> BroadcastConfig
Set client timeout.
Sourcepub fn allow_client_events(self, allow: bool) -> BroadcastConfig
pub fn allow_client_events(self, allow: bool) -> BroadcastConfig
Set whether client events (whisper) are allowed.
Trait Implementations§
Source§impl Clone for BroadcastConfig
impl Clone for BroadcastConfig
Source§fn clone(&self) -> BroadcastConfig
fn clone(&self) -> BroadcastConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BroadcastConfig
impl Debug for BroadcastConfig
Source§impl Default for BroadcastConfig
impl Default for BroadcastConfig
Source§fn default() -> BroadcastConfig
fn default() -> BroadcastConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BroadcastConfig
impl RefUnwindSafe for BroadcastConfig
impl Send for BroadcastConfig
impl Sync for BroadcastConfig
impl Unpin for BroadcastConfig
impl UnsafeUnpin for BroadcastConfig
impl UnwindSafe for BroadcastConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more