discover

suspend fun discover(server: CoapUri, query: String? = null): List<WebLink>(source)

Resource discovery (RFC 6690 §4): GETs /.well-known/core from server (any URI of the server; its path is replaced), with query as RFC 6690 §4.1 filter such as rt=temperature-c, and parses it. The links are the server's input: their targets are text, to be parsed with CoapUri.parseOrNull.

Throws

with CoapException.Reason.BAD_RESPONSE unless the answer is 2.05 link format; for a malformed document, its message says where, and the parser's exception is its cause.


suspend fun discover(server: String, query: String? = null): List<WebLink>(source)

Resource discovery at the server of the CoAP URI server; see discover.