Reconnecting

data class Reconnecting(val attempt: Int, val lastError: MqttException? = null) : ConnectionState

Attempting to re-establish a lost connection.

Entered automatically when the connection drops unexpectedly and MqttConfig.autoReconnect is true. Uses exponential backoff between attempts (configurable via MqttConfig.reconnectBaseDelayMs and MqttConfig.reconnectMaxDelayMs). Subscriptions are automatically re-established on successful reconnection.

Constructors

Link copied to clipboard
constructor(attempt: Int, lastError: MqttException? = null)

Properties

Link copied to clipboard

1-based count of reconnect attempts performed so far. 0 indicates the reconnect loop has just started and no attempt has been made yet.

Link copied to clipboard

The most recent failure that triggered or extended reconnection, or null if reconnect was triggered by a graceful transport drop with no exception.