MqttConnectionKeepAlive class Null safety

Implements keep alive functionality on the Mqtt Connection, ensuring that the connection remains active according to the keep alive seconds setting. This class implements the keep alive by sending an MqttPingRequest to the broker if a message has not been sent or received within the keep alive period.


MqttConnectionKeepAlive(IMqttConnectionHandler connectionHandler, int keepAliveSeconds)
Initializes a new instance of the MqttConnectionKeepAlive class.


hashCode int
The hash code for this object. [...]
read-only, inherited
keepAlivePeriod int
The keep alive period in milliseconds
read / write
pingTimer Timer?
The timer that manages the ping callbacks.
read / write
pongCallback PongCallback?
Ping response received callback
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


messageSent(MqttMessage? msg) bool
Handles the MessageSent event of the connectionHandler control.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
pingRequestReceived(MqttMessage? pingMsg) bool
A ping request has been received from the message broker. The effect of calling this method on the keep alive handler is the transmission of a ping response message to the message broker on the current connection.
pingRequired() bool
Pings the message broker if there has been no activity for the specified amount of idle time.
pingResponseReceived(MqttMessage? pingMsg) bool
Processed ping response messages received from a message broker.
stop() → void
Stop the keep alive process
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]