Table of Contents

Class MqttMsgSubscribe

Namespace
nanoFramework.M2Mqtt.Messages
Assembly
nanoFramework.M2Mqtt.dll

Class for SUBSCRIBE message from client to broker

public class MqttMsgSubscribe : MqttMsgBase
Inheritance
MqttMsgSubscribe
Inherited Members
Extension Methods

Constructors

MqttMsgSubscribe()

Constructor

public MqttMsgSubscribe()

MqttMsgSubscribe(string[], MqttQoSLevel[])

Constructor

public MqttMsgSubscribe(string[] topics, MqttQoSLevel[] qosLevels)

Parameters

topics string[]

List of topics to subscribe

qosLevels MqttQoSLevel[]

List of QOS Levels related to topics

Properties

NoLocal

If True, Application Messages MUST NOT be forwarded to a connection with a ClientID equal to the ClientID of the publishing connection, v5.0 only

public bool NoLocal { get; set; }

Property Value

bool

QoSLevels

List of QOS Levels related to topics

public MqttQoSLevel[] QoSLevels { get; set; }

Property Value

MqttQoSLevel[]

RetainAsPublished

If true, Application Messages forwarded using this subscription keep the RETAIN flag they were published with. If false, Application Messages forwarded using this subscription have the RETAIN flag set to 0 v5.0 only

public bool RetainAsPublished { get; set; }

Property Value

bool

RetainHandeling

Retain Handling option. This option specifies whether retained messages are sent when the subscription is established, v5.0 only

public MqttRetainHandeling RetainHandeling { get; set; }

Property Value

MqttRetainHandeling

SubscriptionIdentifier

The Subscription Identifier can have the value of 1 to 268,435,455, v5.0 only

public int SubscriptionIdentifier { get; set; }

Property Value

int

Topics

List of topics to subscribe

public string[] Topics { get; set; }

Property Value

string[]

Methods

GetBytes(MqttProtocolVersion)

Returns the bytes that represents the current object.

public override byte[] GetBytes(MqttProtocolVersion protocolVersion)

Parameters

protocolVersion MqttProtocolVersion

MQTT protocol version

Returns

byte[]

An array of bytes that represents the current object.

Parse(byte, MqttProtocolVersion, IMqttNetworkChannel)

Parse bytes for a SUBSCRIBE message

public static MqttMsgSubscribe Parse(byte fixedHeaderFirstByte, MqttProtocolVersion protocolVersion, IMqttNetworkChannel channel)

Parameters

fixedHeaderFirstByte byte

First fixed header byte

protocolVersion MqttProtocolVersion

MQTT Protocol Version

channel IMqttNetworkChannel

Channel connected to the broker

Returns

MqttMsgSubscribe

SUBSCRIBE message instance

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.