pub struct HealthCheckConfig {
pub enabled: bool,
pub heartbeat_timeout: Duration,
}Expand description
Configuration for WebSocket connection liveness detection.
A single timeout window controls when the SDK declares the
connection dead: if no inbound frame (heartbeat, data, anything)
arrives within heartbeat_timeout, the dispatch path emits
ConnectionEvent::HeartbeatTimeout
and exits, which lets the reconnect manager take over.
Fields§
§enabled: boolWhether liveness detection is active. Default: true (changed
from false in 2.x). Use HealthCheckConfig::disabled to
opt out — discouraged outside test environments because a
silent connection won’t surface until the OS times out the
underlying TCP, typically hours later.
heartbeat_timeout: DurationMaximum allowed gap between inbound frames before declaring the connection dead.
Default: 35s (the Fugle server emits a heartbeat every 30s;
5s buffer absorbs network jitter). Use HealthCheckConfig::with_timeout
to construct with validation.
Implementations§
Source§impl HealthCheckConfig
impl HealthCheckConfig
Sourcepub fn with_timeout(
timeout: Duration,
) -> Result<HealthCheckConfig, MarketDataError>
pub fn with_timeout( timeout: Duration, ) -> Result<HealthCheckConfig, MarketDataError>
Construct an enabled config with the given timeout.
Returns MarketDataError::ConfigError if timeout is below
the absolute sanity floor (MIN_HEARTBEAT_TIMEOUT_MS).
Note: this only enforces a floor, not a value that’s actually
safe against the live server’s heartbeat period. See the
constant’s docs.
§Errors
Returns MarketDataError on transport, protocol, deserialization,
validation, or peer-initiated failures.
Sourcepub fn disabled() -> HealthCheckConfig
pub fn disabled() -> HealthCheckConfig
Construct a disabled config. Without liveness detection a stalled connection won’t surface until the OS times out the underlying TCP — typically hours on Linux defaults.
Trait Implementations§
Source§impl Clone for HealthCheckConfig
impl Clone for HealthCheckConfig
Source§fn clone(&self) -> HealthCheckConfig
fn clone(&self) -> HealthCheckConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more