-
@Serializable() public final class ConnectionPolicyServer-driven connection policy — the
connectionblock of the settings row (CONNECTION_POLICY_DESIGN.md §2), sibling ofguardrailsand delivered the same way (register-timeconfigSettingson acceptance and refusal) plus live over the WebSocket as apolicy_updatemessage.Same philosophy as GuardrailConfig: lenient parse, and clamps are client-side law — every numeric field is coerced into a safe range, while non-positive, absent, or unparseable values fall back to defaults that exactly reproduce today's shipped behavior. A bad settings edit can degrade to the status quo but can never make the fleet ping every second or hammer
/registerwith zero backoff.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classConnectionPolicy.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Integervprivate final ConnectionKeepAlivekeep_aliveprivate final ConnectionReconnectreconnectprivate final ConnectionReregisterreregisterprivate final ConnectionSocketsocket
-
Constructor Summary
Constructors Constructor Description ConnectionPolicy(Integer v, ConnectionKeepAlive keep_alive, ConnectionReconnect reconnect, ConnectionReregister reregister, ConnectionSocket socket)
-
Method Summary
Modifier and Type Method Description final IntegergetV()final ConnectionKeepAlivegetKeep_alive()final ConnectionReconnectgetReconnect()final ConnectionReregistergetReregister()final ConnectionSocketgetSocket()Server-side lifetime echo; informational only, the SDK never self-closes on it. final LongpingIntervalSeconds()App-level text-ping cadence. final LonginitialDelayMs()First reconnect delay. final Doublemultiplier()Backoff multiplier. final LongmaxDelayMs()Backoff ceiling. final LongjitterMs()Uniform random jitter added to every scheduled delay. final LongreconnectDelayMs(Integer attempt)Backoff delay for a 0-based attempt: min(initial × multiplier^attempt, max). final LongmaxStalenessSeconds()Safety-net re-register threshold. final LongonRefusalRetryMs(Double legacyDeviceTimeoutSeconds)Delay before retrying after a polite refusal (also the "retry_slow" auth cadence). final StringonAuthFailure()What to do on a register 401/403: AUTH_STOP (cease until host restart) or AUTH_RETRY_SLOW (retry on the refusal cadence). -
-
Constructor Detail
-
ConnectionPolicy
ConnectionPolicy(Integer v, ConnectionKeepAlive keep_alive, ConnectionReconnect reconnect, ConnectionReregister reregister, ConnectionSocket socket)
-
-
Method Detail
-
getKeep_alive
final ConnectionKeepAlive getKeep_alive()
-
getReconnect
final ConnectionReconnect getReconnect()
-
getReregister
final ConnectionReregister getReregister()
-
getSocket
final ConnectionSocket getSocket()
Server-side lifetime echo; informational only, the SDK never self-closes on it.
-
pingIntervalSeconds
final Long pingIntervalSeconds()
App-level text-ping cadence. Clamp 15..120 s; default 30 s.
-
initialDelayMs
final Long initialDelayMs()
First reconnect delay. Clamp 250..60000 ms; default 1000 ms (today's BASE_BACKOFF_MS).
-
multiplier
final Double multiplier()
Backoff multiplier. Clamp 1.0..4.0; default 2.0. A "fixed" strategy pins it to 1.0.
-
maxDelayMs
final Long maxDelayMs()
Backoff ceiling. Clamp 5000..3600000 ms; default 30000 ms (today's MAX_BACKOFF_MS).
-
jitterMs
final Long jitterMs()
Uniform random jitter added to every scheduled delay. Clamp ceiling 30000 ms; jitter is mandatory (design §2.1 — no synchronized thundering herds), so a served 0 falls back to the 500 ms default like any non-positive value.
-
reconnectDelayMs
final Long reconnectDelayMs(Integer attempt)
Backoff delay for a 0-based attempt: min(initial × multiplier^attempt, max). No jitter.
-
maxStalenessSeconds
final Long maxStalenessSeconds()
Safety-net re-register threshold. Clamp 3600..604800 s; default 24 h.
-
onRefusalRetryMs
final Long onRefusalRetryMs(Double legacyDeviceTimeoutSeconds)
Delay before retrying after a polite refusal (also the "retry_slow" auth cadence). Policy value (clamp 60..86400 s), else the legacy
device_timeout_interval_seconds, else 600 s — exactly today's fallback chain.
-
onAuthFailure
final String onAuthFailure()
What to do on a register 401/403: AUTH_STOP (cease until host restart) or AUTH_RETRY_SLOW (retry on the refusal cadence). Default — and any unknown value — is "stop": this deliberately replaces the old forever-retry-on-401 behavior (design §5.3 A5, documented intended fix).
-
-
-
-