WillConfig

data class WillConfig(val topic: String, val payload: ByteString = ByteString(), val qos: QoS = QoS.AT_MOST_ONCE, val retain: Boolean = false, val willDelayInterval: Long? = null, val messageExpiryInterval: Long? = null, val contentType: String? = null, val responseTopic: String? = null, val correlationData: ByteString? = null, val payloadFormatIndicator: Boolean = false, val userProperties: List<Pair<String, String>> = emptyList())

Configuration for an MQTT 5.0 Will Message (§3.1.3.2).

The will message is published by the broker when the client disconnects unexpectedly (e.g. network failure, keepalive timeout). If the client disconnects gracefully via MqttClient.disconnect, the will message is discarded unless DISCONNECT is sent with reason code org.meshtastic.mqtt.ReasonCode.DISCONNECT_WITH_WILL.

All binary data uses ByteString for immutability.

Constructors

Link copied to clipboard
constructor(topic: String, payload: ByteString = ByteString(), qos: QoS = QoS.AT_MOST_ONCE, retain: Boolean = false, willDelayInterval: Long? = null, messageExpiryInterval: Long? = null, contentType: String? = null, responseTopic: String? = null, correlationData: ByteString? = null, payloadFormatIndicator: Boolean = false, userProperties: List<Pair<String, String>> = emptyList())
constructor(topic: String, payload: ByteArray, qos: QoS = QoS.AT_MOST_ONCE, retain: Boolean = false, willDelayInterval: Long? = null, messageExpiryInterval: Long? = null, contentType: String? = null, responseTopic: String? = null, correlationData: ByteString? = null, payloadFormatIndicator: Boolean = false, userProperties: List<Pair<String, String>> = emptyList())

Convenience constructor accepting raw bytes (copied into an immutable ByteString).

Types

Link copied to clipboard
class Builder

Mutable builder for WillConfig.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

MIME content type of the will payload (e.g. "application/json").

Link copied to clipboard
val correlationData: ByteString?

Correlation data for request/response pattern in the will message.

Link copied to clipboard

Lifetime of the will message in seconds after publication. Range: 0..4,294,967,295. null = no expiry.

Link copied to clipboard
val payload: ByteString

Payload of the will message as an immutable ByteString.

Link copied to clipboard

If true, the will payload is UTF-8 encoded text.

Link copied to clipboard
val qos: QoS

QoS level for the will message delivery.

Link copied to clipboard

Topic for request/response pattern in the will message.

Link copied to clipboard

If true, the broker retains the will message as the last known good value for topic, delivering it to future subscribers.

Link copied to clipboard

Topic the will message will be published to. Must not be blank.

Link copied to clipboard

Application-defined key-value pairs sent with the will message.

Link copied to clipboard

Delay in seconds between the server detecting an unexpected disconnect and publishing the will message. Allows time for the client to reconnect and cancel the will. Range: 0..4,294,967,295. null = publish immediately (§3.1.3.2).