pub struct ConnectionOptions { /* private fields */ }Expand description
Tunable behaviour of a Connection.
Implementations§
Source§impl ConnectionOptions
impl ConnectionOptions
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Sets the time allowed between sending a request and receiving its response.
A duration below one millisecond is raised to one millisecond.
Sourcepub fn heartbeat_interval(self, interval: Duration) -> Self
pub fn heartbeat_interval(self, interval: Duration) -> Self
Sets the pause after the last write before a heartbeat is sent.
A duration below one millisecond is raised to one millisecond.
Sourcepub fn command_capacity(self, capacity: usize) -> Self
pub fn command_capacity(self, capacity: usize) -> Self
Sets the number of requests that may wait in the command channel.
Zero is raised to one and a number above MAX_COMMAND_CAPACITY is lowered to it.
Sourcepub fn event_capacity(self, capacity: usize) -> Self
pub fn event_capacity(self, capacity: usize) -> Self
Sets the number of events kept for a subscriber that falls behind.
Zero is raised to one and a number above MAX_EVENT_CAPACITY is lowered to it.
Sourcepub fn reconnect_delay(self, delay: Duration) -> Self
pub fn reconnect_delay(self, delay: Duration) -> Self
Sets the pause before the first reconnection attempt; it doubles before every further
attempt up to RECONNECT_DELAY_LIMIT.
A duration below one millisecond is raised to one millisecond.
Sourcepub const fn reconnect_attempts(self, attempts: Option<u32>) -> Self
pub const fn reconnect_attempts(self, attempts: Option<u32>) -> Self
Sets how many times in a row the task tries to connect again before it gives up.
None keeps trying, which is the default; Some(0) turns reconnection off.
Sourcepub fn request_limit(self, limit: u32) -> Self
pub fn request_limit(self, limit: u32) -> Self
Sets the number of requests sent per second, historical data excluded; at least one.
Sourcepub fn historical_limit(self, limit: u32) -> Self
pub fn historical_limit(self, limit: u32) -> Self
Sets the number of requests for historical data sent per second; at least one.
Sourcepub const fn retries(self, retries: u32) -> Self
pub const fn retries(self, retries: u32) -> Self
Sets how often a request is sent again after the server answered that a limit was exceeded; zero hands the error to the caller at once.
Sourcepub fn backoff(self, backoff: Duration) -> Self
pub fn backoff(self, backoff: Duration) -> Self
Sets the pause after the server answered that a limit was exceeded; it doubles with
every retry of the same request up to BACKOFF_LIMIT.
A duration below one millisecond is raised to one millisecond.
Sourcepub fn inbound_timeout(self, period: Duration) -> Self
pub fn inbound_timeout(self, period: Duration) -> Self
Sets how long the server may stay silent before the connection counts as lost.
Every frame the server sends, heartbeats included, starts the period anew. When it runs
out the task reports Event::Disconnected with TransportError::Idle and connects
again. Left unset, the period is DEFAULT_INBOUND_TIMEOUT. It follows from the pace of
the server alone, which sends a heartbeat of its own every
SERVER_HEARTBEAT_INTERVAL on a connection that is otherwise quiet, and from nothing
the client is set to do: neither the heartbeat interval nor the time allowed for a
response changes it. A period shorter than the pace of the server gives up connections
that are in order.
A duration below one millisecond is raised to one millisecond. Duration::MAX turns
the watch off: the server may then stay silent for as long as it likes.