PublishProperties

data class PublishProperties(val messageExpiryInterval: Long? = null, val topicAlias: Int? = null, val contentType: String? = null, val responseTopic: String? = null, val correlationData: ByteString? = null, val payloadFormatIndicator: Boolean = false, val userProperties: List<Pair<String, String>> = emptyList(), val subscriptionIdentifiers: List<Int> = emptyList())

MQTT 5.0 properties that can accompany a PUBLISH packet (§3.3.2.3).

All fields are immutable — ByteString for binary data and defensive list copies. Properties that are null are not present on the wire; the broker and client treat absent properties as "not specified" (which is distinct from zero/empty).

Constructors

Link copied to clipboard
constructor(messageExpiryInterval: Long? = null, topicAlias: Int? = null, contentType: String? = null, responseTopic: String? = null, correlationData: ByteString? = null, payloadFormatIndicator: Boolean = false, userProperties: List<Pair<String, String>> = emptyList(), subscriptionIdentifiers: List<Int> = emptyList())

Properties

Link copied to clipboard

MIME type of the payload (e.g. "application/json", "text/plain"). Informational only — the broker does not interpret this value.

Link copied to clipboard
val correlationData: ByteString?

Opaque binary data used to correlate a response with its original request when using the request/response pattern.

Link copied to clipboard

Lifetime of the message in seconds. After this interval, the broker discards the message if it has not been delivered. Range: 0..4,294,967,295. null means the message does not expire.

Link copied to clipboard

If true, indicates the payload is UTF-8 encoded text. If false (default), the payload format is unspecified (treated as raw bytes).

Link copied to clipboard

The topic that the receiver should publish its response to, enabling the MQTT 5.0 request/response pattern (§4.10).

Link copied to clipboard

Identifiers of the subscriptions that caused this message to be delivered (set by the broker, not the publisher). Each value is in the range 1..268,435,455.

Link copied to clipboard

A numeric alias for the topic name, used for header compression to reduce bandwidth on repeated publishes to the same topic. Range: 1..65,535.

Link copied to clipboard

Application-defined key-value string pairs. Keys may repeat. These are forwarded from the publisher to the subscriber unchanged.