diff --git a/M2Mqtt/MqttClient.cs b/M2Mqtt/MqttClient.cs index 4c155823..3345aa50 100644 --- a/M2Mqtt/MqttClient.cs +++ b/M2Mqtt/MqttClient.cs @@ -481,6 +481,18 @@ public byte Connect(string clientId) return this.Connect(clientId, null, null, false, MqttMsgConnect.QOS_LEVEL_AT_MOST_ONCE, false, null, null, true, MqttMsgConnect.KEEP_ALIVE_PERIOD_DEFAULT); } + /// + /// Connect to broker + /// + /// Client identifier + /// Clean sessione flag + /// Return code of CONNACK message from broker + public byte Connect(string clientId, + bool cleanSession) + { + return this.Connect(clientId, null, null, false, MqttMsgConnect.QOS_LEVEL_AT_MOST_ONCE, false, null, null, cleanSession, MqttMsgConnect.KEEP_ALIVE_PERIOD_DEFAULT); + } + /// /// Connect to broker ///