MqttPublishMessage class

A Publish message is sent to a broker to transport an application message.

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 MqttPublishVariableHeader and MqttPublishPayload.

Inheritance

Constructors

MqttPublishMessage()
Initializes a new instance of the MqttPublishMessage class.
MqttPublishMessage.fromByteBuffer(MqttHeader header, MqttByteBuffer messageStream)
Initializes a new instance of the MqttPublishMessage class.

Properties

hashCode int
The hash code for this object.
no setterinherited
The header of the MQTT Message. Contains metadata about the message
getter/setter pairinherited
isValid bool
Is valid
no setterinherited
payload MqttPublishPayload
Gets or sets the payload of the Mqtt Message.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
variableHeader MqttPublishVariableHeader?
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
clearPublishData() MqttPublishMessage
Removes the current published data, i.e. clears the payload
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
publishData(Uint8Buffer data) MqttPublishMessage
Appends data to publish to the end of the current message payload.
readFrom(MqttByteBuffer messageStream) → void
Reads a message from the supplied stream.
override
setRetain({bool? state}) → void
Set the retain flag on the message
toString() String
A string representation of this object.
override
toTopic(String topicName) MqttPublishMessage
Sets the topic to publish data to.
withContentType(String type) MqttPublishMessage
Content Type
withMessageExpiryInterval(int interval) MqttPublishMessage
Message Expiry Interval
withMessageIdentifier(int messageIdentifier) MqttPublishMessage
Sets the message identifier of the message.
withPayloadFormatIndicator(bool indicator) MqttPublishMessage
Payload Format Indicator
withQos(MqttQos qos) MqttPublishMessage
Sets the Qos of the published message.
withResponseCorrelationdata(Uint8Buffer data) MqttPublishMessage
Correlation Data
withResponseTopic(String topic) MqttPublishMessage
Response Topic
withSubscriptionIdentifier(int identifier) MqttPublishMessage
Subscription Identifier
withTopicAlias(int alias) MqttPublishMessage
Topic Alias
withUserProperties(List<MqttUserProperty>? properties) MqttPublishMessage
Sets a list of user properties
writeTo(MqttByteBuffer messageStream) → void
Writes the message to the supplied stream.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited