Class MqttMsgPublish
- Namespace
- nanoFramework.M2Mqtt.Messages
- Assembly
- nanoFramework.M2Mqtt.dll
Class for PUBLISH message from client to broker
public class MqttMsgPublish : MqttMsgBase
- Inheritance
-
MqttMsgPublish
- Inherited Members
- Extension Methods
Constructors
MqttMsgPublish()
Constructor
public MqttMsgPublish()
MqttMsgPublish(string, byte[])
Constructor
public MqttMsgPublish(string topic, byte[] message)
Parameters
MqttMsgPublish(string, byte[], bool, MqttQoSLevel, bool)
Constructor
public MqttMsgPublish(string topic, byte[] message, bool dupFlag, MqttQoSLevel qosLevel, bool retain)
Parameters
topic
stringMessage topic
message
byte[]Message data
dupFlag
boolDuplicate flag
qosLevel
MqttQoSLevelQuality of Service level
retain
boolRetain flag
Properties
ContentType
The content of the Application Message, v5.0 only
public string ContentType { get; set; }
Property Value
CorrelationData
The Correlation Data is used by the sender of the Request Message to identify which request the Response Message is for when it is received, v5.0 only
public byte[] CorrelationData { get; set; }
Property Value
- byte[]
IsPayloadUTF8
True if the payload is UTF8 encoded, v5.0 only
public bool IsPayloadUTF8 { get; set; }
Property Value
Message
Message data
public byte[] Message { get; set; }
Property Value
- byte[]
MessageExpiryInterval
Message Expiry Interval. If the server did not managed to process it on time, the message must be deleted. Value is the lifetime of the Will Message in seconds and is sent as the Publication Expiry Interval when the Server publishes the Will Message. v5.0 only
public uint MessageExpiryInterval { get; set; }
Property Value
Remarks
The value 0 is the default one, it means, it is not present
ResponseTopic
Response Topic is used as the Topic Name for a response message, v5.0 only
public string ResponseTopic { get; set; }
Property Value
SubscriptionIdentifier
The Subscription Identifier can have the value of 1 to 268,435,455, v5.0 only
public int SubscriptionIdentifier { get; set; }
Property Value
Topic
Message topic
public string Topic { get; set; }
Property Value
TopicAlias
Used instead of the Topic to reduce size of the Publish packet, v5.0 only
public ushort TopicAlias { get; set; }
Property Value
Remarks
The 0 value is not permitted. The client must not send value higher than the Topic Alias Maximum received in the Connack/Connect message.
Methods
GetBytes(MqttProtocolVersion)
Returns the bytes that represents the current object.
public override byte[] GetBytes(MqttProtocolVersion protocolVersion)
Parameters
protocolVersion
MqttProtocolVersionMQTT protocol version
Returns
- byte[]
An array of bytes that represents the current object.
Parse(byte, MqttProtocolVersion, IMqttNetworkChannel)
Parse bytes for a PUBLISH message
public static MqttMsgPublish Parse(byte fixedHeaderFirstByte, MqttProtocolVersion protocolVersion, IMqttNetworkChannel channel)
Parameters
fixedHeaderFirstByte
byteFirst fixed header byte
protocolVersion
MqttProtocolVersionMQTT Protocol Version
channel
IMqttNetworkChannelChannel connected to the broker
Returns
- MqttMsgPublish
PUBLISH message instance
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.