startProbe

open fun startProbe(intervalMillis: Long): Result<Unit>(source)

Starts an opt-in link-quality probe toward peer: every intervalMillis the server sends one 0x81 probe datagram, and each 0x82 reply updates a smoothed RTT / jitter / loss estimate readable via linkQuality. Runs until stopProbe, terminate, or server stop(). Server -> client 0x81 reaches the client whenever the session is live (the client is actively holding its own mapping open); the same cone-NAT caveat as keepAlive applies if the client has gone silent.

The probe requires both ends on webtools-udp 2.0.0+ (as does every framed datagram): a pre-2.0.0 peer never emits or answers 0x81/0x82, so packetLossRatio climbs toward 1.0 and a consumer that opted in against such a peer should not have.

The default returns Result.failure - only the production UDPConnection supports a probe.

Return

Result.success once armed, or the failure that prevented it - including IllegalArgumentException if intervalMillis is below the floor

Parameters

intervalMillis

probe period; must be >= TransportWireFormat.MIN_PROBE_INTERVAL_MILLIS (250 ms).


Starts the probe at the default interval (TransportWireFormat.DEFAULT_PROBE_INTERVAL_MILLIS, 1 s).

Return

Result.success once armed, or the failure that prevented it

See also