getConnectMessage method

  1. @protected
MqttConnectMessage getConnectMessage (
  1. String username,
  2. String password

Gets a pre-configured connect message if one has not been supplied by the user. Returns an MqttConnectMessage that can be used to connect to a message broker.


MqttConnectMessage getConnectMessage(String username, String password) =>
    connectionMessage ??= MqttConnectMessage()
        // Explicitly set the will flag
        .authenticateAs(username, password)