MqttCommunicator constructor

MqttCommunicator({
  1. required String server,
  2. required int port,
  3. String? username,
  4. String? password,
  5. String? clientIdentifier,
  6. bool autoReconnect = true,
  7. bool secure = true,
})

Implementation

MqttCommunicator({
  required String server,
  required int port,
  String? username,
  String? password,
  String? clientIdentifier,
  bool autoReconnect = true,
  bool secure = true,
}) {
  this.server = server;
  this.port = port;
  this.username = username;
  this.password = password;
  clientId = clientIdentifier ??
      "florafi_dart_" + Random().nextInt(1 << 32).toString();

  final client = mqtt = MqttServerClient.withPort(server, clientId, port);
  client.setProtocolV311();
  client.secure = secure;

  client.autoReconnect = autoReconnect;

  messages = _messages.stream;
}