CoapMessage

class CoapMessage(val type: CoapMessageType, val code: CoapCode, val messageId: Int, token: ByteArray, val options: OptionSet, payload: ByteArray)(source)

A CoAP message (RFC 7252 §3): header fields, token, options and payload. Immutable; derive changed copies with toBuilder.

type and messageId belong to the UDP messaging layer. On reliable transports (RFC 8323) they do not exist on the wire: the reliable codec ignores them when encoding and sets CON and 0 when decoding.

Constructors

Link copied to clipboard
constructor(type: CoapMessageType, code: CoapCode, messageId: Int, token: ByteArray, options: OptionSet, payload: ByteArray)

Types

Link copied to clipboard
class Builder

Builds messages; every field has a neutral default.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The token as hex, handy as a map key and in logs.

Link copied to clipboard

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
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun toString(): String

CON 0.01 GET mid=23 token=4a7b [Uri-Path: tv1] 5 bytes; payload content is never shown. Signaling messages show their options by the signaling registry (RFC 8323 §5.2): 7.01 CSM [Max-Message-Size: 1152].