connect method
Future<MqttConnectionStatus>
connect(
- String? server,
- int? port,
- MqttConnectMessage? message
override
Connect to the specific Mqtt Connection.
Implementation
@override
Future<MqttConnectionStatus> connect(
String? server,
int? port,
MqttConnectMessage? message,
) async {
// Save the parameters for auto reconnect.
this.server = server;
this.port = port;
MqttLogger.log(
'MqttConnectionHandlerBase::connect - server $server, port $port',
);
connectionMessage = message;
try {
await internalConnect(server, port, message);
return connectionStatus;
} on Exception {
connectionStatus.state = MqttConnectionState.faulted;
rethrow;
}
}