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 moresource§impl Debug for PingConfig
impl Debug for PingConfig
source§impl Default for PingConfig
impl Default for PingConfig
source§fn default() -> PingConfig
fn default() -> PingConfig
impl Copy for PingConfig
Auto Trait Implementations§
impl Freeze for PingConfig
impl RefUnwindSafe for PingConfig
impl Send for PingConfig
impl Sync for PingConfig
impl Unpin for PingConfig
impl UnwindSafe for PingConfig
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)