Package-level declarations

Types

Link copied to clipboard

A CoAP client on a CoapEndpoint.

Link copied to clipboard

How a CoapClient sends requests.

Link copied to clipboard
fun interface EndpointResolver

Finds the transport endpoint for a URI's host and port. The kind of Endpoint it returns picks the endpoint's transport: an Endpoint.Udp or Endpoint.Secure its datagram transport, an Endpoint.Tcp or Endpoint.WebSocket a connection.

Link copied to clipboard

How a CoapClient ends an observation whose collector went away (RFC 7641 §3.6).

Link copied to clipboard
class QBlockClientConfig(val mode: QBlockMode = QBlockMode.OFF, val probePath: String = "/.well-known/core", val capabilityLifetime: Duration = 1.hours, val onReliableTransports: Boolean = false, val withMessageSecurity: Boolean = false, val missingBlockMBit: Boolean = false)

How a CoapClient uses Q-Block (RFC 9177): bodies sent and received in bursts of MAX_PAYLOADS blocks (dev.kcoap.coap.stack.TransmissionParameters.maxPayloads) that recover lost blocks without a round trip per block. Off by default.

Link copied to clipboard

Whether a CoapClient uses Q-Block (RFC 9177) instead of Block1 and Block2 (RFC 7959) for its requests.

Link copied to clipboard
class RetryAfter(val maxWait: Duration = DEFAULT_MAX_WAIT, val maxAttempts: Int = DEFAULT_MAX_ATTEMPTS)

Sends a request again when the server asks to be asked later, as RFC 8516 §4 has a client do: while the answer is 4.29 Too Many Requests, or 5.03 Service Unavailable with the same meaning for an overload of all clients (RFC 7252 §5.9.3.4), it waits as long as the response's Max-Age says (CoapResponse.retryAfter, 60 seconds without one) and sends the request again, maxAttempts times at most in all.

Functions

Link copied to clipboard

The CoapClientConfig that block sets up on a CoapClientConfig.Builder; what is not set keeps its default:

Link copied to clipboard

The peer for uri through this client's CoapClientConfig.resolver, with the resolver's failures translated as the EndpointResolver contract says: a CoapException, such as CoapException.Reason.UNRESOLVED_HOST, and an IllegalArgumentException for a host the resolver cannot resolve by design pass unchanged; any other exception is a lookup that failed at runtime, CoapException.Reason.UNRESOLVED_HOST with it as cause. That includes a cancellation of the resolver's own, such as its withTimeout expiring, while the caller is still active; the caller's cancellation passes unchanged.