authenticateAs method

MqttConnectMessage authenticateAs(
  1. String? username,
  2. String? password
)

Sets the authentication

Implementation

MqttConnectMessage authenticateAs(String? username, String? password) {
  if (username != null) {
    variableHeader!.connectFlags.usernameFlag = username.isNotEmpty;
    payload.username = username;
  }
  if (password != null) {
    variableHeader!.connectFlags.passwordFlag = password.isNotEmpty;
    payload.password = password;
  }
  return this;
}