Struct twitch_irc::ClientConfig [−][src]
Configures settings for a TwitchIRCClient.
Fields
login_credentials: LGets a set of credentials every time the client needs to log in on a new connection.
See LoginCredentials for details.
max_channels_per_connection: usizeA new connection will automatically be created if a channel is joined and all currently established connections have joined at least this many channels.
max_waiting_messages_per_connection: usizeA new connection will automatically be created if any message is to be sent
and all currently established connections have recently sent more than this many
messages (time interval is defined by max_waiting_messages_duration_window)
time_per_message: DurationWe assume messages to be "waiting" for this amount of time after sending them out, e.g. typically 100 or 150 milliseconds (purely a value that has been measured/observed, not documented or fixed in any way)
connection_rate_limiter: Arc<Semaphore>rate-limits the opening of new connections. By default this is constructed with 1 permit only, which means connections cannot be opened in parallel. If this is set to more than 1 permit, then that many connections can be opened in parallel.
This is designed to be wrapped in an Arc to allow it to be shared between multiple TwitchIRCClient instances.
new_connection_every: DurationAllow a new connection to be made after this period has elapsed. By default this is set to 2 seconds, and combined with the permits=1 of the semaphore, allows one connection to be made every 2 seconds.
More specifically, after taking the permit from the semaphore, the permit will be put back after this period has elapsed.
connect_timeout: DurationImposes a general timeout for new connections. This is in place in addition to possible operating system timeouts (E.g. for new TCP connections), since additional "connect" work takes place after the TCP connection is opened, e.g. to set up TLS or perform a WebSocket handshake. Default value: 20 seconds.
metrics_identifier: Option<Cow<'static, str>>Set this to None to disable metrics collection for this client.
If this is set to Some(value), then metrics are collected from this client using
the metrics crate under the twitch_irc_ prefix. Because multiple clients
may coexist at the same time, this string should be picked to be unique in your application.
The client will label all metrics it publishes using this identifier string.
The specific client is then identified using the client label on all metrics below.
Currently exported metrics:
-
twitch_irc_messages_receivedwith labelcommandcounts all incoming messages. (Counter) -
twitch_irc_messages_sentcounts messages sent out, with acommandlabel. (Counter) -
twitch_irc_channelswithtype=allocated/confirmedcounts how many channels you are joined to (Gauge). Allocated channels are joins that passed through theTwitchIRCClientbut may be waiting e.g. for the connection to finish connecting. Once a confirmation response is received by Twitch that the channel was joined successfully, that channel is additionallyconfirmed. -
twitch_irc_connectionscounts how many connections this client has in use (Gauge). The labelstate=initializing/openidentifies how many connections are in the process of connecting (initializing) vs how many connections are already established (open). -
twitch_irc_reconnectscounts every time a connection fails (Counter). Note however, depending on conditions e.g. how many channels were joined on that channel, the connection may not actually have been reconnected (despite the nametwitch_irc_reconnects). If other connections have enough capacity left to join the channels from the failed connection, then no new connection will be made.
Implementations
impl<L: LoginCredentials> ClientConfig<L>[src]
pub fn new_simple(login_credentials: L) -> ClientConfig<L>[src]
Create a new configuration from the given login credentials, with all other configuration options being default.
Trait Implementations
impl<L: Debug + LoginCredentials> Debug for ClientConfig<L>[src]
impl Default for ClientConfig<StaticLoginCredentials>[src]
Auto Trait Implementations
impl<L> !RefUnwindSafe for ClientConfig<L>[src]
impl<L> Send for ClientConfig<L>[src]
impl<L> Sync for ClientConfig<L>[src]
impl<L> Unpin for ClientConfig<L> where
L: Unpin, [src]
L: Unpin,
impl<L> !UnwindSafe for ClientConfig<L>[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,