MqttConnectionHandlerBase class

This class provides shared connection functionality to serverand browser connection handler implementations.

Implemented types


MqttConnectionHandlerBase(EventBus clientEventBus, {@required int maxConnectionAttempts})
Initializes a new instance of the MqttConnectionHandlerBase class.


autoReconnectInProgress bool
Auto reconnect in progress
read / write, override
clientEventBus EventBus
The event bus
@protected, read / write
connection ↔ dynamic
The connection
@protected, read / write
connectionMessage MqttConnectMessage
read / write, override
connectionStatus MqttClientConnectionStatus
Connection status
read / write, override-getter
connectTimer MqttCancellableAsyncSleep
The broker connection acknowledgment timer
@protected, read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
initialConnectionComplete bool
We have had an initial connection
@protected, read / write
maxConnectionAttempts int
Max connection attempts
messageProcessorRegistry Map<MqttMessageType, MessageCallbackFunction>
Registry of message processors
@protected, read / write
onAutoReconnect AutoReconnectCallback
Auto reconnect callback
read / write, override
onAutoReconnected AutoReconnectCompleteCallback
Auto reconnected callback
read / write, override
onBadCertificate bool Function(dynamic certificate)
Callback function to handle bad certificate. if true, ignore the error.
read / write, override
onConnected ConnectCallback
Successful connection callback.
read / write, override
onDisconnected DisconnectCallback
Unsolicited disconnection callback.
read / write, override
port int
read / write, override
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
sentMessageCallbacks List<MessageCallbackFunction>
Registry of sent message callbacks
@protected, read / write
server String
read / write, override
websocketProtocols List<String>
User supplied websocket protocols
@protected, read / write


autoReconnect(AutoReconnect reconnectEvent) → void
Auto reconnect
close() → void
Closes the connection to the Mqtt message broker.
connect(String server, int port, MqttConnectMessage message) Future<MqttClientConnectionStatus>
Connect to the specific Mqtt Connection.
connectAckProcessor(MqttMessage msg) bool
Processes the connect acknowledgement message.
connectAckReceived(ConnectAckMessageAvailable event) → void
Connect acknowledge recieved
disconnect() MqttConnectionState
initialiseListeners() → void
Initialise the event listeners;
internalConnect(String hostname, int port, MqttConnectMessage message) Future<MqttClientConnectionStatus>
Connect to the specific Mqtt Connection internally.
messageAvailable(MessageAvailable event) → void
Handles the Message Available event of the connection control for handling non connection messages.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
registerForAllSentMessages(MessageCallbackFunction sentMsgCallback) → void
Registers a callback to be called whenever a message is sent.
registerForMessage(MqttMessageType msgType, MessageCallbackFunction callback) → void
Registers for the receipt of messages when they arrive.
sendMessage(MqttMessage message) → void
Sends a message to the broker through the current connection.
toString() String
Returns a string representation of this object.
unRegisterForAllSentMessages(MessageCallbackFunction sentMsgCallback) → void
UnRegisters a callback that is called whenever a message is sent.
unRegisterForMessage(MqttMessageType msgType) → void
UnRegisters for the receipt of messages when they arrive.


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