Connection
A single named, logical connection to one remote client of a MultiConnectionUDPServer.
UDPConnection is the production implementation: a socket-free handle over the server's single shared UDP socket. The interface exists so the server's registration and handshake logic can be exercised against a socket-free fake.
UDPConnection is still socket-free and owns no thread of its own; an opt-in scheduled keepalive (startKeepAlive) borrows the server's shared mcups-keepalive thread rather than starting one per connection, and an opt-in link-quality probe (startProbe) likewise borrows the server's shared mcups-probe thread and updates a per-connection estimator.
Inheritors
Properties
Functions
Registers onMessage as the handler for datagrams from this client. No socket is bound - the server already owns the one shared socket; this only routes inbound datagrams whose source matches peer to onMessage. Calling this on a connection that has been terminated is a silent no-op (see terminate). The handler receives the trimmed UTF-8 text of each datagram; for a binary protocol use actuateBytes instead.
The delivery-mode-scoped handle for this connection. Each DeliveryMode has its own sequence space and its own inbound handler - binding a handler on one mode's UdpChannel never disturbs the other's.
The latest link-quality snapshot for this connection, or null if no probe is running or none has resolved yet.
Starts the scheduled keepalive at the recommended interval (TransportWireFormat.DEFAULT_KEEPALIVE_INTERVAL_MILLIS, 20 s).
Starts an opt-in, idle-aware background keepalive for this connection: every ~intervalMillis of output silence toward peer the server sends one 0x80 keepalive datagram, until stopKeepAlive, terminate, or server stop().
Starts the probe at the default interval (TransportWireFormat.DEFAULT_PROBE_INTERVAL_MILLIS, 1 s).
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.
Stops the background keepalive started by startKeepAlive. Idempotent; a no-op if none is running or the implementation does not support one. terminate and server stop() also do this.
Stops the probe started by startProbe. Idempotent; terminate and server stop() also do this. The last linkQuality snapshot remains readable. A probe still unanswered when the probe stopped is counted as lost once it passes the loss horizon, so packetLossRatio can still settle for up to three probe intervals after this call.
Fully deregisters this connection: its message handler is cleared and its registration is removed from the server entirely, so it is no longer addressed by MultiConnectionUDPServer.pushToAll and any subsequent datagram from peer is dropped as unregistered. This is final - calling actuate again afterward is a silent no-op, since there is no longer a registration to bind against; the client must complete a fresh Iam handshake to be registered again.