Companion

Properties

Link copied to clipboard
const val MAX_TOKEN_LENGTH: Int = 8

RFC 7252 §3: tokens are 0 to 8 bytes.

Functions

Link copied to clipboard
Link copied to clipboard
fun empty(type: CoapMessageType, messageId: Int): CoapMessage

An Empty ACK or RST for messageId (RFC 7252 §4.2, §4.3).

Link copied to clipboard
fun request(method: CoapCode, block: CoapMessage.Builder.() -> Unit = {}): CoapMessage

A request with method; set the token, Message ID and options in block.

Link copied to clipboard
fun response(request: CoapMessage, code: CoapCode, block: CoapMessage.Builder.() -> Unit = {}): CoapMessage

A response to request, with its token; the type and Message ID are left to the caller.