ReliableMessageCodec

The CoAP message format for reliable transports (RFC 8323 §3.2 and §4.2). There is no version, type or Message ID; a length field (Len) gives the size of options and payload:

| Len  |  TKL  | Extended Length (0-4 bytes) | Code | Token (TKL bytes) | Options | 0xFF | Payload |

Over TCP and TLS, Len is 0–12 or selects a 1, 2 or 4-byte extended length. Over WebSockets the frame carries the length, so Len MUST be 0 and there is no extended length.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun decode(bytes: ByteArray): CoapMessage

Decodes exactly one message; bytes must contain nothing else.

Link copied to clipboard
open override fun encode(message: CoapMessage): ByteArray