pub struct PingConfig { /* private fields */ }
Expand description
Configuration for WebSocket ping/pong mechanism and it may be used to disconnect an inactive connection.
jsonrpsee doesn’t associate the ping/pong frames just that if
a pong frame isn’t received within the inactive_limit
then it’s regarded
as missed.
Such that the inactive_limit
should be configured to longer than a single
WebSocket ping takes or it might be missed and may end up
terminating the connection.
Default: ping_interval: 30 seconds, max failures: 1 and inactive limit: 40 seconds.
Implementations§
Source§impl PingConfig
impl PingConfig
Sourcepub fn new() -> PingConfig
pub fn new() -> PingConfig
Create a new PingConfig.
Sourcepub fn ping_interval(self, ping_interval: Duration) -> PingConfig
pub fn ping_interval(self, ping_interval: Duration) -> PingConfig
Configure the interval when the WebSocket pings are sent out.
Sourcepub fn inactive_limit(self, inactivity_limit: Duration) -> PingConfig
pub fn inactive_limit(self, inactivity_limit: Duration) -> PingConfig
Configure how long to wait for the WebSocket pong. When this limit is expired it’s regarded as inresponsive.
You may configure how many times the connection is allowed to
be inactive by PingConfig::max_failures
.
Sourcepub fn max_failures(self, max: usize) -> PingConfig
pub fn max_failures(self, max: usize) -> PingConfig
Configure how many times the connection is allowed be inactive until the connection is closed.
§Panics
This method panics if max
== 0.
Trait Implementations§
Source§impl Clone for PingConfig
impl Clone for PingConfig
Source§fn clone(&self) -> PingConfig
fn clone(&self) -> PingConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more