MqttConnectionKeepAlive class

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

Constructors

MqttConnectionKeepAlive(MqttIConnectionHandler connectionHandler, EventBus? eventBus, int keepAliveSeconds, [int disconnectOnNoResponsePeriod = 0])
Initializes a new instance of the MqttConnectionKeepAlive class.

Properties

disconnectOnNoResponsePeriod int
The period of time to wait if the broker does not respond to a ping request, in milliseconds. If this time period is exceeded the client is forcibly disconnected. The default is 0, which disables this functionality.
getter/setter pair
disconnectTimer Timer?
Timer that manages the disconnect on no ping response period.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
keepAlivePeriod int
The keep alive period in milliseconds
getter/setter pair
pingTimer Timer?
The timer that manages the ping callbacks.
getter/setter pair
pongCallback PongCallback?
Ping response received callback
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

messageSent(MqttMessage? msg) bool
Handles the MessageSent event of the connectionHandler control.
noMessageSent() → void
Handle when send message throws error
noPingResponseReceived() → void
Handle the disconnect timer timeout
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pingRequestReceived(MqttMessage? pingMsg) bool
Signal to the keepalive that a ping request has been received from the message broker. The effect of calling this method on the keepalive 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.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited