MqttConnectMessage class
An Mqtt message that is used to initiate a connection to a message broker. After a network connection is established by a client to a broker, the first message sent from the client to the broker MUST be a connect message.
A client can only send the connect message once over a network connection.
Various fields are used in the construction of this message, for more details on the meaning of these fields please refer to the classes in which they are defined, specifically MqttConnectFlags, MqttConnectPayload, MqttConnectVariableHeader and MqttWillProperties.
In particular if using a will message refer to the MqttWillProperties class for details of the options in this area.
- Inheritance
-
- Object
- MqttMessage
- MqttConnectMessage
Constructors
- MqttConnectMessage()
- Initializes a new instance of the MqttConnectMessage class.
Properties
- authenticationRequested → bool
-
Indicates if an authentication method is set
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- header ↔ MqttHeader?
-
The header of the MQTT Message. Contains metadata about the message
getter/setter pairinherited
- isValid → bool
-
Is valid
no setterinherited
- payload ↔ MqttConnectPayload
-
The payload of the message.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- variableHeader → MqttConnectVariableHeader?
-
The variable header contents.
Contains extended metadata about the message.
no setter
Methods
-
addUserProperty(
MqttUserProperty property) → void - Add a specific user property
-
addUserPropertyPair(
String name, String value) → void - Add a user property from the supplied name/value pair
-
authenticateAs(
String? username, String? password) → MqttConnectMessage - Sets the authentication details
-
keepAliveFor(
int keepAliveSeconds) → MqttConnectMessage - Sets the keep alive period
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readFrom(
MqttByteBuffer messageStream) → void -
Reads a message from the supplied stream.
inherited
-
startClean(
) → MqttConnectMessage - Sets the clean start flag to clear any persistent session for the client. Mutually exclusive with startSessionthe last method applied to the message will take effect.
-
startSession(
{int sessionExpiryInterval = MqttConnectVariableHeader.sessionDoesNotExpire}) → MqttConnectMessage -
Starts a persistent session with the broker.
The
sessionExpiryInterval
can be any none zero value up to the the maximum MqttConnectVariableHeader.sessionDoesNotExpire. If 0 is passed the maximum value is used. Mutually exclusive with startClean, the last method applied to the message will take effect. -
toString(
) → String -
A string representation of this object.
override
-
will(
) → MqttConnectMessage - Sets the Will flag.
-
withAuthenticationData(
Uint8Buffer data) → MqttConnectMessage - Sets the authentication data
-
withAuthenticationMethod(
String method) → MqttConnectMessage - Sets the authentication method.
-
withClientIdentifier(
String clientIdentifier) → MqttConnectMessage - Sets the client identifier of the message.
-
withMaximumMessageSize(
int maximum) → MqttConnectMessage - Sets the maximum message size.
-
withPayload(
MqttConnectPayload payload) → MqttConnectMessage - Sets the message payload
-
withReceiveMaximum(
int maximum) → MqttConnectMessage - Sets the receive maximum.
-
withRequestProblemInformation(
bool information) → MqttConnectMessage - Sets the request problem information flag.
-
withRequestResponseInformation(
bool information) → MqttConnectMessage - Sets the request response information flag.
-
withSessionExpiryInterval(
int interval) → MqttConnectMessage - Sets the session expiry interval.
-
withTopicAliasMaximum(
int maximum) → MqttConnectMessage - Sets the topic alias maximum.
-
withUserProperties(
List< MqttUserProperty> properties) → MqttConnectMessage - Sets a list of user properties
-
withWillPayload(
Uint8Buffer willPayload) → MqttConnectMessage - Sets the will payload.
-
withWillProperties(
MqttWillProperties properties) → MqttConnectMessage - Sets the will properties
-
withWillQos(
MqttQos qos) → MqttConnectMessage - Sets the Will Qos.
-
withWillRetain(
) → MqttConnectMessage - Sets the Will retain flag.
-
withWillTopic(
String willTopic) → MqttConnectMessage - Sets the Will topic.
-
writeTo(
MqttByteBuffer messageStream) → void -
Writes the message to the supplied stream.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited