CoapResponse

class CoapResponse(val code: CoapCode, val options: OptionSet = OptionSet.EMPTY, payload: ByteArray = ByteArray(0))(source)

A response as the application sees it: code, options and the whole body. Block-wise transfers are already reassembled, and the messaging-layer fields (type, Message ID, token) are not part of it.

A server resource returns one; a client receives one. Immutable.

Constructors

Link copied to clipboard
constructor(code: CoapCode, options: OptionSet = OptionSet.EMPTY, payload: ByteArray = ByteArray(0))

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

The Content-Format option, or null.

Link copied to clipboard

Whether the code is 2.xx.

Link copied to clipboard
Link copied to clipboard

The whole body; a copy.

Link copied to clipboard
Link copied to clipboard

How long the server asks the client to wait before it sends this request, or a similar one, again: the Max-Age of a 4.29 Too Many Requests (RFC 8516 §4) or of a 5.03 Service Unavailable (RFC 7252 §5.9.3.4), or 60 seconds, Max-Age's default (RFC 7252 §5.10.5), when it carries none; null for every other code. RFC 8516 §1 counts a request with the same method and URI as similar, and lets the application decide for others. RetryAfter in kcoap-coap waits it out and repeats the request.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

The body as UTF-8 text.

Link copied to clipboard

This response as a message with token, for the stack to send: the type and Message ID are placeholders that the messaging layer replaces (RFC 7252 §4), and a reliable transport has neither (RFC 8323 §3.2).

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

2.05 Content [Content-Format: 0] 12 bytes; the payload itself is never shown.

Link copied to clipboard

A copy with block applied to its options.