CoapClientConfig

How a CoapClient sends requests.

Build one with the DSL, CoapClientConfig { requestTimeout = 5.seconds }, or with a Builder (CoapClientConfig.Builder(), set its properties, build()), which reads the same from Swift; Default has every default, and toBuilder starts from an existing configuration. The configuration itself is immutable, and every value is checked when it is built. Options added later go into the builder, so code that builds a configuration keeps compiling, and compiled code keeps linking.

Types

Link copied to clipboard
class Builder

Collects the values of a CoapClientConfig; every property starts at its default, documented on the property of the same name. Not thread safe: build on one thread, then share the configuration.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Whether a 4.01 with Echo is answered by repeating the request once with that Echo value (RFC 9175 §2.3: SHOULD).

Link copied to clipboard

The largest body assembled from Block2 transfers.

Link copied to clipboard

What a cancelled observation does (RFC 7641 §3.6). Over reliable transports the client always deregisters (RFC 8323 §7.4).

Link copied to clipboard

The block size the client prefers, 16..1024: Block1 uploads use it, and setting it turns on early negotiation, so every request without a body proposes it as the Block2 size of the response (RFC 7959 §2.4); a server may still choose smaller blocks. Null, the default, uses the largest size the datagram (or the server's Max-Message-Size, with BERT where both sides indicated it, RFC 8323 §6) fits and lets the server choose the response block size. Set, it also turns BERT off. The server's counterpart is its upper bound CoapServerConfig.maxBlockSize.

Link copied to clipboard

Whether and how requests use Q-Block (RFC 9177) instead of RFC 7959; off by default. preferredBlockSize and maxResponseBodySize apply to Q-Block bodies too.

Link copied to clipboard

How long to wait for the response to one request (one block), measured from sending; null waits EXCHANGE_LIFETIME. A Confirmable request without ACK fails earlier, after MAX_TRANSMIT_WAIT.

Link copied to clipboard

Turns the host of a URI into a transport Endpoint; EndpointResolver.Default takes IP literals for every scheme and passes host names to the connectors of RFC 8323 schemes.

Link copied to clipboard

Message security (OSCORE) for outgoing requests, called below block-wise and Observe and above the messaging layer (RFC 8613 Figure 1); null sends requests unprotected.

Link copied to clipboard

Bytes kept free in each message for security's overhead when choosing block sizes.

Functions

Link copied to clipboard

A Builder holding this configuration's values, to build a changed copy.

Link copied to clipboard
open override fun toString(): String