pub struct ClientConfig {
pub timeout: Duration,
pub reconnector: Option<Box<dyn Reconnector>>,
pub reconnect_policy: ReconnectPolicy,
pub keepalive: KeepaliveBehavior,
}Expand description
Everything Client::from_transport_with_config needs beyond the transport halves and the
runtime. Introduced because the option set had outgrown positional parameters -
from_transport_with_reconnect already took seven arguments, and keepalive would have made it
eight or forced a third constructor.
Defaults are deliberately inert: no reconnector, no keepalive. ConnectOptions (the
WebSocket convenience path) opts into both, but a caller assembling a client from raw
transport halves gets exactly the behavior they asked for and nothing more.
Fields§
§timeout: DurationHow long to wait for a CALLRESULT/CALLERROR, and the default pong deadline.
reconnector: Option<Box<dyn Reconnector>>Redials when the transport closes. None means the read loop exits on disconnect.
reconnect_policy: ReconnectPolicyBackoff between failed reconnect attempts. Ignored when reconnector is None.
keepalive: KeepaliveBehaviorWhether to ping the peer on a schedule, and what to do when it stops answering.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn with_reconnect(
self,
reconnector: Box<dyn Reconnector>,
policy: ReconnectPolicy,
) -> Self
pub fn with_reconnect( self, reconnector: Box<dyn Reconnector>, policy: ReconnectPolicy, ) -> Self
Redial through reconnector, backing off per policy, when the transport closes.
Sourcepub fn with_keepalive(self, keepalive: KeepaliveBehavior) -> Self
pub fn with_keepalive(self, keepalive: KeepaliveBehavior) -> Self
Ping the peer per keepalive.