pub struct KeepAlive {
pub interval: Duration,
pub timeout: Duration,
pub close: CloseFrame,
}Expand description
Server-initiated keepalive: send a Ping when the connection goes idle, and disconnect the peer if it doesn’t respond in time.
This is the proactive half of ping/pong — wslay already auto-answers incoming pings, but never initiates its own. Browsers can’t send pings from JavaScript, so liveness for an h2ts client must be driven from the server; the browser’s platform auto-answers these pings transparently.
Fields§
§interval: DurationSend a Ping once the connection has been idle (no frame received) this long.
timeout: DurationIf no frame arrives within this long after that Ping, close the peer.
close: CloseFrameClose frame sent to the peer, and surfaced to BridgeConfig::on_close,
when keepalive fails. Defaults to 1001 (Going Away), “keepalive timeout”.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeepAlive
impl RefUnwindSafe for KeepAlive
impl Send for KeepAlive
impl Sync for KeepAlive
impl Unpin for KeepAlive
impl UnsafeUnpin for KeepAlive
impl UnwindSafe for KeepAlive
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
Mutably borrows from an owned value. Read more