diff --git a/Source/MQTTnet.Extensions.ManagedClient/IManagedMqttClient.cs b/Source/MQTTnet.Extensions.ManagedClient/IManagedMqttClient.cs
index cc2490cb..4e06eaf9 100644
--- a/Source/MQTTnet.Extensions.ManagedClient/IManagedMqttClient.cs
+++ b/Source/MQTTnet.Extensions.ManagedClient/IManagedMqttClient.cs
@@ -16,36 +16,95 @@ namespace MQTTnet.Extensions.ManagedClient
///
IMqttClient InternalClient { get; }
+ ///
+ /// Gets a value indicating whether the client is started or not.
+ ///
bool IsStarted { get; }
-
+
+ ///
+ /// Gets a value indicating whether the client is connected or not.
+ ///
bool IsConnected { get; }
+ ///
+ /// Gets a pending application message count.
+ ///
int PendingApplicationMessagesCount { get; }
+ ///
+ /// Gets the MQTT client options.
+ ///
IManagedMqttClientOptions Options { get; }
+ ///
+ /// Gets or sets the connected handler.
+ ///
IMqttClientConnectedHandler ConnectedHandler { get; set; }
-
+
+ ///
+ /// Gets or sets the disconnected handler.
+ ///
IMqttClientDisconnectedHandler DisconnectedHandler { get; set; }
+ ///
+ /// Gets or sets the application message process handler.
+ ///
IApplicationMessageProcessedHandler ApplicationMessageProcessedHandler { get; set; }
-
+
+ ///
+ /// Gets or sets the application message skipped handler.
+ ///
IApplicationMessageSkippedHandler ApplicationMessageSkippedHandler { get; set; }
+ ///
+ /// Gets or sets the connecting failed handler.
+ ///
IConnectingFailedHandler ConnectingFailedHandler { get; set; }
+ ///
+ /// Gets or sets the synchronizing subscriptions failed handler.
+ ///
ISynchronizingSubscriptionsFailedHandler SynchronizingSubscriptionsFailedHandler { get; set; }
+ ///
+ /// Starts the client.
+ ///
+ /// The options.
+ /// A representing any asynchronous operation.
Task StartAsync(IManagedMqttClientOptions options);
-
+
+ ///
+ /// Stops the client.
+ ///
+ /// A representing any asynchronous operation.
Task StopAsync();
-
+
+ ///
+ /// Pings the server.
+ ///
+ /// A token to cancel the task.
+ /// A representing any asynchronous operation.
Task PingAsync(CancellationToken cancellationToken);
+ ///
+ /// Subscribes the client.
+ ///
+ /// The topic filters.
+ /// A representing any asynchronous operation.
Task SubscribeAsync(IEnumerable topicFilters);
-
+
+ ///
+ /// Unsubscribes the client.
+ ///
+ /// The topics.
+ /// A representing any asynchronous operation.
Task UnsubscribeAsync(IEnumerable topics);
+ ///
+ /// Publishes a message from the client.
+ ///
+ /// The application messages.
+ /// A representing any asynchronous operation.
Task PublishAsync(ManagedMqttApplicationMessage applicationMessages);
}
}
\ No newline at end of file
diff --git a/Source/MQTTnet/Client/Connecting/IMqttClientConnectedHandler.cs b/Source/MQTTnet/Client/Connecting/IMqttClientConnectedHandler.cs
index 8b7be27e..233ee577 100644
--- a/Source/MQTTnet/Client/Connecting/IMqttClientConnectedHandler.cs
+++ b/Source/MQTTnet/Client/Connecting/IMqttClientConnectedHandler.cs
@@ -4,6 +4,11 @@ namespace MQTTnet.Client.Connecting
{
public interface IMqttClientConnectedHandler
{
+ ///
+ /// Handles the events when a client gets connected.
+ ///
+ /// The event args.
+ /// A representing any asynchronous operation.
Task HandleConnectedAsync(MqttClientConnectedEventArgs eventArgs);
}
}
diff --git a/Source/MQTTnet/Client/Connecting/MqttClientAuthenticateResult.cs b/Source/MQTTnet/Client/Connecting/MqttClientAuthenticateResult.cs
index 7419fae0..dfcaaff1 100644
--- a/Source/MQTTnet/Client/Connecting/MqttClientAuthenticateResult.cs
+++ b/Source/MQTTnet/Client/Connecting/MqttClientAuthenticateResult.cs
@@ -7,42 +7,110 @@ namespace MQTTnet.Client.Connecting
// TODO: Consider renaming this to _MqttClientConnectResult_
public class MqttClientAuthenticateResult
{
+ ///
+ /// Gets or sets the result code.
+ /// Hint: MQTT 5 feature only.
+ ///
public MqttClientConnectResultCode ResultCode { get; set; }
+ ///
+ /// Gets or sets a value indicating whether the session is present or not.
+ ///
public bool IsSessionPresent { get; set; }
+ ///
+ /// Gets or sets a value indicating whether wildcard subscriptions are available.
+ ///
public bool? WildcardSubscriptionAvailable { get; set; }
+ ///
+ /// Gets or sets a value indicating whether retained messages are available.
+ ///
public bool? RetainAvailable { get; set; }
+ ///
+ /// Gets or sets the assigned client identifier.
+ ///
public string AssignedClientIdentifier { get; set; }
+ ///
+ /// Gets or sets the authentication method.
+ /// Hint: MQTT 5 feature only.
+ ///
public string AuthenticationMethod { get; set; }
+ ///
+ /// Gets or sets the authentication data.
+ /// Hint: MQTT 5 feature only.
+ ///
public byte[] AuthenticationData { get; set; }
+ ///
+ /// Gets or sets the maximum packet size.
+ ///
public uint? MaximumPacketSize { get; set; }
+ ///
+ /// Gets or sets the reason string.
+ /// Hint: MQTT 5 feature only.
+ ///
public string ReasonString { get; set; }
+ ///
+ /// Gets or sets the receive maximum.
+ ///
public ushort? ReceiveMaximum { get; set; }
+ ///
+ /// Gets or sets the maximum quality od service level.
+ ///
public MqttQualityOfServiceLevel MaximumQoS { get; set; }
+ ///
+ /// Gets or sets the response information.
+ /// Hint: MQTT 5 feature only.
+ ///
public string ResponseInformation { get; set; }
+ ///
+ /// Gets or sets the topic alias maximum.
+ ///
public ushort? TopicAliasMaximum { get; set; }
+ ///
+ /// Gets or sets the server reference.
+ ///
public string ServerReference { get; set; }
+ ///
+ /// Gets or sets the server keep alive.
+ ///
public ushort? ServerKeepAlive { get; set; }
+ ///
+ /// Gets or sets the session expiry interval.
+ ///
public uint? SessionExpiryInterval { get; set; }
+ ///
+ /// Gets or sets a value indicating whether the subscription identifiers are available or not.
+ /// Hint: MQTT 5 feature only.
+ ///
public bool? SubscriptionIdentifiersAvailable { get; set; }
+ ///
+ /// Gets or sets a value indicating whether the shared subscriptions are available or not.
+ /// Hint: MQTT 5 feature only.
+ ///
public bool? SharedSubscriptionAvailable { get; set; }
+ ///
+ /// Gets or sets the user properties.
+ /// In MQTT 5, user properties are basic UTF-8 string key-value pairs that you can append to almost every type of MQTT packet.
+ /// As long as you don’t exceed the maximum message size, you can use an unlimited number of user properties to add metadata to MQTT messages and pass information between publisher, broker, and subscriber.
+ /// The feature is very similar to the HTTP header concept.
+ /// Hint: MQTT 5 feature only.
+ ///
public List UserProperties { get; set; }
}
}
diff --git a/Source/MQTTnet/Client/Connecting/MqttClientConnectedEventArgs.cs b/Source/MQTTnet/Client/Connecting/MqttClientConnectedEventArgs.cs
index e7f97b9e..02cd47f5 100644
--- a/Source/MQTTnet/Client/Connecting/MqttClientConnectedEventArgs.cs
+++ b/Source/MQTTnet/Client/Connecting/MqttClientConnectedEventArgs.cs
@@ -9,6 +9,10 @@ namespace MQTTnet.Client.Connecting
AuthenticateResult = authenticateResult ?? throw new ArgumentNullException(nameof(authenticateResult));
}
+ ///
+ /// Gets the authentication result.
+ /// Hint: MQTT 5 feature only.
+ ///
public MqttClientAuthenticateResult AuthenticateResult { get; }
}
}
diff --git a/Source/MQTTnet/Client/Disconnecting/IMqttClientDisconnectedHandler.cs b/Source/MQTTnet/Client/Disconnecting/IMqttClientDisconnectedHandler.cs
index 14347bf0..81e0b9ba 100644
--- a/Source/MQTTnet/Client/Disconnecting/IMqttClientDisconnectedHandler.cs
+++ b/Source/MQTTnet/Client/Disconnecting/IMqttClientDisconnectedHandler.cs
@@ -4,6 +4,11 @@ namespace MQTTnet.Client.Disconnecting
{
public interface IMqttClientDisconnectedHandler
{
+ ///
+ /// Handles the events when a client gets disconnected.
+ ///
+ /// The event args.
+ /// A representing any asynchronous operation.
Task HandleDisconnectedAsync(MqttClientDisconnectedEventArgs eventArgs);
}
}
diff --git a/Source/MQTTnet/Client/Disconnecting/MqttClientDisconnectOptions.cs b/Source/MQTTnet/Client/Disconnecting/MqttClientDisconnectOptions.cs
index 995806e7..97ab6443 100644
--- a/Source/MQTTnet/Client/Disconnecting/MqttClientDisconnectOptions.cs
+++ b/Source/MQTTnet/Client/Disconnecting/MqttClientDisconnectOptions.cs
@@ -2,8 +2,16 @@
{
public class MqttClientDisconnectOptions
{
+ ///
+ /// Gets or sets the reason code.
+ /// Hint: MQTT 5 feature only.
+ ///
public MqttClientDisconnectReason ReasonCode { get; set; } = MqttClientDisconnectReason.NormalDisconnection;
+ ///
+ /// Gets or sets the reason string.
+ /// Hint: MQTT 5 feature only.
+ ///
public string ReasonString { get; set; }
}
}
diff --git a/Source/MQTTnet/Client/Disconnecting/MqttClientDisconnectedEventArgs.cs b/Source/MQTTnet/Client/Disconnecting/MqttClientDisconnectedEventArgs.cs
index 5e2317cf..aa026342 100644
--- a/Source/MQTTnet/Client/Disconnecting/MqttClientDisconnectedEventArgs.cs
+++ b/Source/MQTTnet/Client/Disconnecting/MqttClientDisconnectedEventArgs.cs
@@ -15,12 +15,26 @@ namespace MQTTnet.Client.Disconnecting
ReasonCode = reason;
}
+ ///
+ /// Gets a value indicating whether the client was connected or not.
+ ///
public bool ClientWasConnected { get; }
+ ///
+ /// Gets the exception.
+ ///
public Exception Exception { get; }
+ ///
+ /// Gets the authentication result.
+ /// Hint: MQTT 5 feature only.
+ ///
public MqttClientAuthenticateResult AuthenticateResult { get; }
+ ///
+ /// Gets or sets the reason.
+ /// Hint: MQTT 5 feature only.
+ ///
public MqttClientDisconnectReason Reason { get; set; }
[Obsolete("Please use 'Reason' instead. This property will be removed in the future!")]
diff --git a/Source/MQTTnet/Client/ExtendedAuthenticationExchange/IMqttExtendedAuthenticationExchangeHandler.cs b/Source/MQTTnet/Client/ExtendedAuthenticationExchange/IMqttExtendedAuthenticationExchangeHandler.cs
index 8cd35420..69a689cc 100644
--- a/Source/MQTTnet/Client/ExtendedAuthenticationExchange/IMqttExtendedAuthenticationExchangeHandler.cs
+++ b/Source/MQTTnet/Client/ExtendedAuthenticationExchange/IMqttExtendedAuthenticationExchangeHandler.cs
@@ -4,6 +4,11 @@ namespace MQTTnet.Client.ExtendedAuthenticationExchange
{
public interface IMqttExtendedAuthenticationExchangeHandler
{
+ ///
+ /// Handles the authentication request.
+ ///
+ /// The context.
+ /// A representing any asynchronous operation.
Task HandleRequestAsync(MqttExtendedAuthenticationExchangeContext context);
}
}
diff --git a/Source/MQTTnet/Client/ExtendedAuthenticationExchange/MqttExtendedAuthenticationExchangeContext.cs b/Source/MQTTnet/Client/ExtendedAuthenticationExchange/MqttExtendedAuthenticationExchangeContext.cs
index 9e88f039..a83576db 100644
--- a/Source/MQTTnet/Client/ExtendedAuthenticationExchange/MqttExtendedAuthenticationExchangeContext.cs
+++ b/Source/MQTTnet/Client/ExtendedAuthenticationExchange/MqttExtendedAuthenticationExchangeContext.cs
@@ -20,16 +20,42 @@ namespace MQTTnet.Client.ExtendedAuthenticationExchange
Client = client ?? throw new ArgumentNullException(nameof(client));
}
+ ///
+ /// Gets the reason code.
+ /// Hint: MQTT 5 feature only.
+ ///
public MqttAuthenticateReasonCode ReasonCode { get; }
+ ///
+ /// Gets the reason string.
+ /// Hint: MQTT 5 feature only.
+ ///
public string ReasonString { get; }
+ ///
+ /// Gets the authentication method.
+ /// Hint: MQTT 5 feature only.
+ ///
public string AuthenticationMethod { get; }
+ ///
+ /// Gets the authentication data.
+ /// Hint: MQTT 5 feature only.
+ ///
public byte[] AuthenticationData { get; }
+ ///
+ /// Gets the user properties.
+ /// In MQTT 5, user properties are basic UTF-8 string key-value pairs that you can append to almost every type of MQTT packet.
+ /// As long as you don’t exceed the maximum message size, you can use an unlimited number of user properties to add metadata to MQTT messages and pass information between publisher, broker, and subscriber.
+ /// The feature is very similar to the HTTP header concept.
+ /// Hint: MQTT 5 feature only.
+ ///
public List UserProperties { get; }
+ ///
+ /// Gets the client.
+ ///
public IMqttClient Client { get; }
}
}
diff --git a/Source/MQTTnet/Client/ExtendedAuthenticationExchange/MqttExtendedAuthenticationExchangeData.cs b/Source/MQTTnet/Client/ExtendedAuthenticationExchange/MqttExtendedAuthenticationExchangeData.cs
index 8a49b08a..29f38217 100644
--- a/Source/MQTTnet/Client/ExtendedAuthenticationExchange/MqttExtendedAuthenticationExchangeData.cs
+++ b/Source/MQTTnet/Client/ExtendedAuthenticationExchange/MqttExtendedAuthenticationExchangeData.cs
@@ -6,12 +6,33 @@ namespace MQTTnet.Client.ExtendedAuthenticationExchange
{
public class MqttExtendedAuthenticationExchangeData
{
+ ///
+ /// Gets or sets the reason code.
+ /// Hint: MQTT 5 feature only.
+ ///
public MqttAuthenticateReasonCode ReasonCode { get; set; }
+ ///
+ /// Gets or sets the reason string.
+ /// Hint: MQTT 5 feature only.
+ ///
public string ReasonString { get; set; }
+ ///
+ /// Gets or sets the authentication data.
+ /// Authentication data is binary information used to transmit multiple iterations of cryptographic secrets of protocol steps.
+ /// The content of the authentication data is highly dependent on the specific implementation of the authentication method.
+ /// Hint: MQTT 5 feature only.
+ ///
public byte[] AuthenticationData { get; set; }
+ ///
+ /// Gets or sets the user properties.
+ /// In MQTT 5, user properties are basic UTF-8 string key-value pairs that you can append to almost every type of MQTT packet.
+ /// As long as you don’t exceed the maximum message size, you can use an unlimited number of user properties to add metadata to MQTT messages and pass information between publisher, broker, and subscriber.
+ /// The feature is very similar to the HTTP header concept.
+ /// Hint: MQTT 5 feature only.
+ ///
public List UserProperties { get; }
}
}
diff --git a/Source/MQTTnet/Client/IMqttClient.cs b/Source/MQTTnet/Client/IMqttClient.cs
index 58cfa0c1..95ee1d92 100644
--- a/Source/MQTTnet/Client/IMqttClient.cs
+++ b/Source/MQTTnet/Client/IMqttClient.cs
@@ -12,19 +12,75 @@ namespace MQTTnet.Client
{
public interface IMqttClient : IApplicationMessageReceiver, IApplicationMessagePublisher, IDisposable
{
+ ///
+ /// Gets a value indicating whether the client is connected or not.
+ ///
bool IsConnected { get; }
+
+ ///
+ /// Gets the options.
+ /// This contains all the set options for the client.
+ ///
IMqttClientOptions Options { get; }
+ ///
+ /// Gets or sets the connected handler that is fired after the client has connected to the server successfully.
+ /// Hint: Initialize handlers before you connect the client to avoid issues.
+ ///
IMqttClientConnectedHandler ConnectedHandler { get; set; }
+ ///
+ /// Gets or sets the disconnected handler that is fired after the client has disconnected from the server.
+ /// Hint: Initialize handlers before you connect the client to avoid issues.
+ ///
IMqttClientDisconnectedHandler DisconnectedHandler { get; set; }
+ ///
+ /// Connects the client to the server using the specified options.
+ ///
+ /// The options that can be used on connect.
+ /// A cancellation token to stop the task.
+ /// A result containing the authentication result information.
Task ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken);
+
+ ///
+ /// Disconnects the client from the server.
+ ///
+ /// The options containing a disconnect reason.
+ /// A cancellation token to stop the task.
+ /// A representing any asynchronous operation.
Task DisconnectAsync(MqttClientDisconnectOptions options, CancellationToken cancellationToken);
+
+ ///
+ /// Pings the server.
+ ///
+ /// A cancellation token to stop the task.
+ /// A representing any asynchronous operation.
Task PingAsync(CancellationToken cancellationToken);
+ ///
+ /// Sends extended authentication data.
+ /// Hint: MQTT 5 feature only.
+ ///
+ /// The extended data.
+ /// A cancellation token to stop the task.
+ /// A representing any asynchronous operation.
Task SendExtendedAuthenticationExchangeDataAsync(MqttExtendedAuthenticationExchangeData data, CancellationToken cancellationToken);
+
+ ///
+ /// Subscribes the client to topics.
+ ///
+ /// The subscription options.
+ /// A cancellation token to stop the task.
+ /// A representing any asynchronous operation.
Task SubscribeAsync(MqttClientSubscribeOptions options, CancellationToken cancellationToken);
+
+ ///
+ /// Unsubscribes the client from topics.
+ ///
+ /// The unsubscription options.
+ /// A cancellation token to stop the task.
+ /// A representing any asynchronous operation.
Task UnsubscribeAsync(MqttClientUnsubscribeOptions options, CancellationToken cancellationToken);
}
}
\ No newline at end of file
diff --git a/Source/MQTTnet/Client/IMqttClientFactory.cs b/Source/MQTTnet/Client/IMqttClientFactory.cs
index b256e742..54707fff 100644
--- a/Source/MQTTnet/Client/IMqttClientFactory.cs
+++ b/Source/MQTTnet/Client/IMqttClientFactory.cs
@@ -1,5 +1,4 @@
-using System;
-using MQTTnet.Adapter;
+using MQTTnet.Adapter;
using MQTTnet.Diagnostics;
using MQTTnet.LowLevelClient;
@@ -7,22 +6,67 @@ namespace MQTTnet.Client
{
public interface IMqttClientFactory
{
+ ///
+ /// A method to tell the client to use the adapter factory.
+ ///
+ /// The client adapter factory.
+ /// A new .
IMqttFactory UseClientAdapterFactory(IMqttClientAdapterFactory clientAdapterFactory);
+ ///
+ /// Creates a new low level MQTT client.
+ ///
+ /// A new .
ILowLevelMqttClient CreateLowLevelMqttClient();
+ ///
+ /// Creates a new low level MQTT client.
+ ///
+ /// The logger.
+ /// A new .
ILowLevelMqttClient CreateLowLevelMqttClient(IMqttNetLogger logger);
+ ///
+ /// Creates a new low level MQTT client.
+ ///
+ /// The client adapter factory.
+ /// A new .
ILowLevelMqttClient CreateLowLevelMqttClient(IMqttClientAdapterFactory clientAdapterFactory);
+ ///
+ /// Creates a new low level MQTT client.
+ ///
+ /// The logger.
+ /// The client adapter factory.
+ /// A new .
ILowLevelMqttClient CreateLowLevelMqttClient(IMqttNetLogger logger, IMqttClientAdapterFactory clientAdapterFactory);
+ ///
+ /// Creates a new MQTT client.
+ ///
+ /// A new .
IMqttClient CreateMqttClient();
+ ///
+ /// Creates a new MQTT client.
+ ///
+ /// The logger.
+ /// A new .
IMqttClient CreateMqttClient(IMqttNetLogger logger);
+ ///
+ /// Creates a new MQTT client.
+ ///
+ /// The adapter factory.
+ /// A new .
IMqttClient CreateMqttClient(IMqttClientAdapterFactory adapterFactory);
+ ///
+ /// Creates a new MQTT client.
+ ///
+ /// The logger.
+ /// The adapter factory.
+ /// A new .
IMqttClient CreateMqttClient(IMqttNetLogger logger, IMqttClientAdapterFactory adapterFactory);
}
}
\ No newline at end of file
diff --git a/Source/MQTTnet/Client/Options/IMqttClientOptions.cs b/Source/MQTTnet/Client/Options/IMqttClientOptions.cs
index e46162ae..642a8728 100644
--- a/Source/MQTTnet/Client/Options/IMqttClientOptions.cs
+++ b/Source/MQTTnet/Client/Options/IMqttClientOptions.cs
@@ -8,26 +8,122 @@ namespace MQTTnet.Client.Options
{
public interface IMqttClientOptions
{
+ ///
+ /// Gets the client identifier.
+ /// Hint: This identifier needs to be unique over all used clients / devices on the broker to avoid connection issues.
+ ///
string ClientId { get; }
+
+ ///
+ /// Gets a value indicating whether clean sessions are used or not.
+ /// When a client connects to a broker it can connect using either a non persistent connection (clean session) or a persistent connection.
+ /// With a non persistent connection the broker doesn't store any subscription information or undelivered messages for the client.
+ /// This mode is ideal when the client only publishes messages.
+ /// It can also connect as a durable client using a persistent connection.
+ /// In this mode, the broker will store subscription information, and undelivered messages for the client.
+ ///
bool CleanSession { get; }
+
+ ///
+ /// Gets the credentials.
+ ///
IMqttClientCredentials Credentials { get; }
+
+ ///
+ /// Gets the extended authentication exchange handler.
+ ///
IMqttExtendedAuthenticationExchangeHandler ExtendedAuthenticationExchangeHandler { get; }
+
+ ///
+ /// Gets the protocol version.
+ ///
MqttProtocolVersion ProtocolVersion { get; }
+
+ ///
+ /// Gets the channel options.
+ ///
IMqttClientChannelOptions ChannelOptions { get; }
+ ///
+ /// Gets the timeout the communication uses.
+ ///
TimeSpan CommunicationTimeout { get; }
+
+ ///
+ /// Gets the keep alive period.
+ /// The connection is normally left open by the client so that is can send and receive data at any time.
+ /// If no data flows over an open connection for a certain time period then the client will generate a PINGREQ and expect to receive a PINGRESP from the broker.
+ /// This message exchange confirms that the connection is open and working.
+ /// This period is known as the keep alive period.
+ ///
TimeSpan KeepAlivePeriod { get; }
+
+ ///
+ /// Gets the last will message.
+ /// In MQTT, you use the last will message feature to notify other clients about an ungracefully disconnected client.
+ ///
MqttApplicationMessage WillMessage { get; }
+
+ ///
+ /// Gets the will delay interval.
+ /// This is the time between the client disconnect and the time the will message will be sent.
+ ///
uint? WillDelayInterval { get; }
+ ///
+ /// Gets the authentication method.
+ /// Hint: MQTT 5 feature only.
+ ///
string AuthenticationMethod { get; }
+
+ ///
+ /// Gets the authentication data.
+ /// Hint: MQTT 5 feature only.
+ ///
byte[] AuthenticationData { get; }
+
+ ///
+ /// Gets the maximum packet size.
+ ///
uint? MaximumPacketSize { get; }
+
+ ///
+ /// Gets the receive maximum.
+ /// This gives the maximum length of the receive messages.
+ ///
ushort? ReceiveMaximum { get; }
+
+ ///
+ /// Gets the request problem information.
+ /// Hint: MQTT 5 feature only.
+ ///
bool? RequestProblemInformation { get; }
+
+ ///
+ /// Gets the request response information.
+ /// Hint: MQTT 5 feature only.
+ ///
bool? RequestResponseInformation { get; }
+
+ ///
+ /// Gets the session expiry interval.
+ /// The time after a session expires when it's not actively used.
+ ///
uint? SessionExpiryInterval { get; }
+
+ ///
+ /// Gets the topic alias maximum.
+ /// This gives the maximum length of the topic alias.
+ ///
ushort? TopicAliasMaximum { get; }
+
+ ///
+ /// Gets or sets the user properties.
+ /// In MQTT 5, user properties are basic UTF-8 string key-value pairs that you can append to almost every type of MQTT packet.
+ /// As long as you don’t exceed the maximum message size, you can use an unlimited number of user properties to add metadata to MQTT messages and pass information between publisher, broker, and subscriber.
+ /// The feature is very similar to the HTTP header concept.
+ /// Hint: MQTT 5 feature only.
+ ///
List UserProperties { get; set; }
}
}
\ No newline at end of file
diff --git a/Source/MQTTnet/Client/Options/MqttClientCertificateValidationCallbackContext.cs b/Source/MQTTnet/Client/Options/MqttClientCertificateValidationCallbackContext.cs
index 3827f05d..0a863017 100644
--- a/Source/MQTTnet/Client/Options/MqttClientCertificateValidationCallbackContext.cs
+++ b/Source/MQTTnet/Client/Options/MqttClientCertificateValidationCallbackContext.cs
@@ -5,12 +5,24 @@ namespace MQTTnet.Client.Options
{
public class MqttClientCertificateValidationCallbackContext
{
+ ///
+ /// Gets or sets the certificate.
+ ///
public X509Certificate Certificate { get; set; }
+ ///
+ /// Gets or sets the certificate chain.
+ ///
public X509Chain Chain { get; set; }
+ ///
+ /// Gets or sets the SSL policy errors.
+ ///
public SslPolicyErrors SslPolicyErrors { get; set; }
+ ///
+ /// Gets or sets the client options.
+ ///
public IMqttClientChannelOptions ClientOptions { get; set; }
}
}
diff --git a/Source/MQTTnet/Client/Options/MqttClientOptions.cs b/Source/MQTTnet/Client/Options/MqttClientOptions.cs
index 79c6c702..e150e496 100644
--- a/Source/MQTTnet/Client/Options/MqttClientOptions.cs
+++ b/Source/MQTTnet/Client/Options/MqttClientOptions.cs
@@ -8,28 +8,122 @@ namespace MQTTnet.Client.Options
{
public class MqttClientOptions : IMqttClientOptions
{
+ ///
+ /// Gets the client identifier.
+ /// Hint: This identifier needs to be unique over all used clients / devices on the broker to avoid connection issues.
+ ///
public string ClientId { get; set; } = Guid.NewGuid().ToString("N");
+
+ ///
+ /// Gets or sets a value indicating whether clean sessions are used or not.
+ /// When a client connects to a broker it can connect using either a non persistent connection (clean session) or a persistent connection.
+ /// With a non persistent connection the broker doesn't store any subscription information or undelivered messages for the client.
+ /// This mode is ideal when the client only publishes messages.
+ /// It can also connect as a durable client using a persistent connection.
+ /// In this mode, the broker will store subscription information, and undelivered messages for the client.
+ ///
public bool CleanSession { get; set; } = true;
+
+ ///
+ /// Gets or sets the credentials.
+ ///
public IMqttClientCredentials Credentials { get; set; }
+
+ ///
+ /// Gets or sets the extended authentication exchange handler.
+ ///
public IMqttExtendedAuthenticationExchangeHandler ExtendedAuthenticationExchangeHandler { get; set; }
+
+ ///
+ /// Gets or sets the protocol version.
+ ///
public MqttProtocolVersion ProtocolVersion { get; set; } = MqttProtocolVersion.V311;
+ ///
+ /// Gets or sets the channel options.
+ ///
public IMqttClientChannelOptions ChannelOptions { get; set; }
+
+ ///
+ /// Gets or sets the timeout the communication uses.
+ ///
public TimeSpan CommunicationTimeout { get; set; } = TimeSpan.FromSeconds(10);
+
+ ///
+ /// Gets or sets the keep alive period.
+ /// The connection is normally left open by the client so that is can send and receive data at any time.
+ /// If no data flows over an open connection for a certain time period then the client will generate a PINGREQ and expect to receive a PINGRESP from the broker.
+ /// This message exchange confirms that the connection is open and working.
+ /// This period is known as the keep alive period.
+ ///
public TimeSpan KeepAlivePeriod { get; set; } = TimeSpan.FromSeconds(15);
+ ///
+ /// Gets or sets the last will message.
+ /// In MQTT, you use the last will message feature to notify other clients about an ungracefully disconnected client.
+ ///
public MqttApplicationMessage WillMessage { get; set; }
+
+ ///
+ /// Gets or sets the will delay interval.
+ /// This is the time between the client disconnect and the time the will message will be sent.
+ ///
public uint? WillDelayInterval { get; set; }
+ ///
+ /// Gets or sets the authentication method.
+ /// Hint: MQTT 5 feature only.
+ ///
public string AuthenticationMethod { get; set; }
+
+ ///
+ /// Gets or sets the authentication data.
+ /// Hint: MQTT 5 feature only.
+ ///
public byte[] AuthenticationData { get; set; }
+ ///
+ /// Gets or sets the maximum packet size.
+ ///
public uint? MaximumPacketSize { get; set; }
+
+ ///
+ /// Gets or sets the receive maximum.
+ /// This gives the maximum length of the receive messages.
+ ///
public ushort? ReceiveMaximum { get; set; }
+
+ ///
+ /// Gets or sets the request problem information.
+ /// Hint: MQTT 5 feature only.
+ ///
public bool? RequestProblemInformation { get; set; }
+
+ ///
+ /// Gets or sets the request response information.
+ /// Hint: MQTT 5 feature only.
+ ///
public bool? RequestResponseInformation { get; set; }
+
+ ///
+ /// Gets or sets the session expiry interval.
+ /// The time after a session expires when it's not actively used.
+ ///
public uint? SessionExpiryInterval { get; set; }
+
+ ///
+ /// Gets or sets the topic alias maximum.
+ /// This gives the maximum length of the topic alias.
+ ///
public ushort? TopicAliasMaximum { get; set; }
+
+ ///
+ /// Gets or sets the user properties.
+ /// In MQTT 5, user properties are basic UTF-8 string key-value pairs that you can append to almost every type of MQTT packet.
+ /// As long as you don’t exceed the maximum message size, you can use an unlimited number of user properties to add metadata to MQTT messages and pass information between publisher, broker, and subscriber.
+ /// The feature is very similar to the HTTP header concept.
+ /// Hint: MQTT 5 feature only.
+ ///
public List UserProperties { get; set; }
}
}
diff --git a/Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs b/Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs
index 68d1aa3f..402f28a1 100644
--- a/Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs
+++ b/Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs
@@ -17,6 +17,11 @@ namespace MQTTnet.Client.Options
MqttClientOptionsBuilderTlsParameters _tlsParameters;
MqttClientWebSocketProxyOptions _proxyOptions;
+ ///
+ /// Adds the protocol version to the MQTT client options.
+ ///
+ /// The protocol version.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithProtocolVersion(MqttProtocolVersion value)
{
if (value == MqttProtocolVersion.Unknown)
@@ -28,47 +33,88 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Adds the communication timeout to the MQTT client options.
+ ///
+ /// The timeout.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithCommunicationTimeout(TimeSpan value)
{
_options.CommunicationTimeout = value;
return this;
}
+ ///
+ /// Adds the clean session flag to the MQTT client options.
+ ///
+ /// The clean session flag.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithCleanSession(bool value = true)
{
_options.CleanSession = value;
return this;
}
+ ///
+ /// Adds the keep alive send interval to the MQTT client options.
+ ///
+ /// The keep alive interval.
+ /// A new instance of the class.
[Obsolete("This method is no longer supported. The client will send ping requests just before the keep alive interval is going to elapse. As per MQTT RFC the serve has to wait 1.5 times the interval so we don't need this anymore.")]
public MqttClientOptionsBuilder WithKeepAliveSendInterval(TimeSpan value)
{
return this;
}
+ ///
+ /// Adds no keep alive period to the MQTT client options.
+ ///
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithNoKeepAlive()
{
return WithKeepAlivePeriod(TimeSpan.Zero);
}
+ ///
+ /// Adds the keep alive period to the MQTT client options.
+ ///
+ /// The keep alive period.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithKeepAlivePeriod(TimeSpan value)
{
_options.KeepAlivePeriod = value;
return this;
}
+ ///
+ /// Adds the client identifier to the MQTT client options.
+ ///
+ /// The client identifier.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithClientId(string value)
{
_options.ClientId = value;
return this;
}
+ ///
+ /// Adds the will message to the MQTT client options.
+ ///
+ /// The will message.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithWillMessage(MqttApplicationMessage value)
{
_options.WillMessage = value;
return this;
}
+ ///
+ /// Adds the authentication to the MQTT client options.
+ /// Hint: MQTT 5 feature only.
+ ///
+ /// The authentication method.
+ /// The data.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithAuthentication(string method, byte[] data)
{
_options.AuthenticationMethod = method;
@@ -76,48 +122,92 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Adds the will delay interval to the MQTT client options.
+ ///
+ /// The will delay interval.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithWillDelayInterval(uint? willDelayInterval)
{
_options.WillDelayInterval = willDelayInterval;
return this;
}
+ ///
+ /// Adds the topic alias maximum to the MQTT client options.
+ ///
+ /// The topic alias maximum.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithTopicAliasMaximum(ushort? topicAliasMaximum)
{
_options.TopicAliasMaximum = topicAliasMaximum;
return this;
}
+ ///
+ /// Adds the maximum packet size to the MQTT client options.
+ ///
+ /// The maximum packet size.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithMaximumPacketSize(uint? maximumPacketSize)
{
_options.MaximumPacketSize = maximumPacketSize;
return this;
}
+ ///
+ /// Adds the receive maximum to the MQTT client options.
+ ///
+ /// The receive maximum.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithReceiveMaximum(ushort? receiveMaximum)
{
_options.ReceiveMaximum = receiveMaximum;
return this;
}
+ ///
+ /// Adds the request problem information to the MQTT client options.
+ /// Hint: MQTT 5 feature only.
+ ///
+ /// The request problem information.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithRequestProblemInformation(bool? requestProblemInformation = true)
{
_options.RequestProblemInformation = requestProblemInformation;
return this;
}
+ ///
+ /// Adds the request response information to the MQTT client options.
+ /// Hint: MQTT 5 feature only.
+ ///
+ /// The request response information.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithRequestResponseInformation(bool? requestResponseInformation = true)
{
_options.RequestResponseInformation = requestResponseInformation;
return this;
}
+ ///
+ /// Adds the session expiry interval to the MQTT client options.
+ ///
+ /// The session expiry interval.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithSessionExpiryInterval(uint? sessionExpiryInterval)
{
_options.SessionExpiryInterval = sessionExpiryInterval;
return this;
}
+ ///
+ /// Adds the user property to the MQTT client options.
+ /// Hint: MQTT 5 feature only.
+ ///
+ /// The user property name.
+ /// The user property value.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithUserProperty(string name, string value)
{
if (name is null) throw new ArgumentNullException(nameof(name));
@@ -132,6 +222,12 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Adds the credentials to the MQTT client options.
+ ///
+ /// The user name.
+ /// The password.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithCredentials(string username, string password = null)
{
byte[] passwordBuffer = null;
@@ -144,6 +240,12 @@ namespace MQTTnet.Client.Options
return WithCredentials(username, passwordBuffer);
}
+ ///
+ /// Adds the credentials to the MQTT client options.
+ ///
+ /// The user name.
+ /// The password.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithCredentials(string username, byte[] password = null)
{
_options.Credentials = new MqttClientCredentials
@@ -155,6 +257,11 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Adds the credentials to the MQTT client options.
+ ///
+ /// The credentials.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithCredentials(IMqttClientCredentials credentials)
{
_options.Credentials = credentials;
@@ -162,12 +269,23 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Adds a extended authentication exchange handler to the MQTT client options.
+ ///
+ /// The handler.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithExtendedAuthenticationExchangeHandler(IMqttExtendedAuthenticationExchangeHandler handler)
{
_options.ExtendedAuthenticationExchangeHandler = handler;
return this;
}
+ ///
+ /// Adds a TCP server connection to the MQTT client options.
+ ///
+ /// The server.
+ /// The port.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithTcpServer(string server, int? port = null)
{
_tcpOptions = new MqttClientTcpOptions
@@ -179,6 +297,11 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Adds a TCP server connection to the MQTT client options.
+ ///
+ /// The options builder.
+ /// A new instance of the class.
// TODO: Consider creating _MqttClientTcpOptionsBuilder_ as overload.
public MqttClientOptionsBuilder WithTcpServer(Action optionsBuilder)
{
@@ -190,6 +313,16 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Adds a proxy connection to the MQTT client options.
+ ///
+ /// The address.
+ /// The user name.
+ /// The password.
+ /// The domain.
+ /// The bypass on local flag.
+ /// The bypass list.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithProxy(string address, string username = null, string password = null, string domain = null, bool bypassOnLocal = false, string[] bypassList = null)
{
_proxyOptions = new MqttClientWebSocketProxyOptions
@@ -205,6 +338,11 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Adds a proxy connection to the MQTT client options.
+ ///
+ /// The options builder.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithProxy(Action optionsBuilder)
{
if (optionsBuilder == null) throw new ArgumentNullException(nameof(optionsBuilder));
@@ -214,6 +352,12 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Adds a web socket server to the MQTT client options.
+ ///
+ /// The uri.
+ /// The parameters.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithWebSocketServer(string uri, MqttClientOptionsBuilderWebSocketParameters parameters = null)
{
_webSocketOptions = new MqttClientWebSocketOptions
@@ -226,6 +370,11 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Adds a web socket server to the MQTT client options.
+ ///
+ /// The options builder.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithWebSocketServer(Action optionsBuilder)
{
if (optionsBuilder == null) throw new ArgumentNullException(nameof(optionsBuilder));
@@ -236,17 +385,31 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Adds TLS to the MQTT client options.
+ ///
+ /// The parameters.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithTls(MqttClientOptionsBuilderTlsParameters parameters)
{
_tlsParameters = parameters;
return this;
}
+ ///
+ /// Adds TLS to the MQTT client options.
+ ///
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithTls()
{
return WithTls(new MqttClientOptionsBuilderTlsParameters { UseTls = true });
}
+ ///
+ /// Adds TLS to the MQTT client options.
+ ///
+ /// The options builder.
+ /// A new instance of the class.
public MqttClientOptionsBuilder WithTls(Action optionsBuilder)
{
if (optionsBuilder == null) throw new ArgumentNullException(nameof(optionsBuilder));
@@ -256,6 +419,10 @@ namespace MQTTnet.Client.Options
return this;
}
+ ///
+ /// Builds the MQTT client options.
+ ///
+ /// The .
public IMqttClientOptions Build()
{
if (_tcpOptions == null && _webSocketOptions == null)
diff --git a/Source/MQTTnet/Client/Publishing/MqttClientPublishResult.cs b/Source/MQTTnet/Client/Publishing/MqttClientPublishResult.cs
index 15035ec0..0a51c989 100644
--- a/Source/MQTTnet/Client/Publishing/MqttClientPublishResult.cs
+++ b/Source/MQTTnet/Client/Publishing/MqttClientPublishResult.cs
@@ -6,12 +6,30 @@ namespace MQTTnet.Client.Publishing
{
public class MqttClientPublishResult
{
+ ///
+ /// Gets or sets the packet identifier.
+ ///
public ushort? PacketIdentifier { get; set; }
+ ///
+ /// Gets or sets the reason code.
+ /// Hint: MQTT 5 feature only.
+ ///
public MqttClientPublishReasonCode ReasonCode { get; set; } = MqttClientPublishReasonCode.Success;
+ ///
+ /// Gets or sets the reason string.
+ /// Hint: MQTT 5 feature only.
+ ///
public string ReasonString { get; set; }
+ ///
+ /// Gets or sets the user properties.
+ /// In MQTT 5, user properties are basic UTF-8 string key-value pairs that you can append to almost every type of MQTT packet.
+ /// As long as you don’t exceed the maximum message size, you can use an unlimited number of user properties to add metadata to MQTT messages and pass information between publisher, broker, and subscriber.
+ /// The feature is very similar to the HTTP header concept.
+ /// Hint: MQTT 5 feature only.
+ ///
public List UserProperties { get; set; }
}
}
diff --git a/Source/MQTTnet/Client/Receiving/IMqttApplicationMessageReceivedHandler.cs b/Source/MQTTnet/Client/Receiving/IMqttApplicationMessageReceivedHandler.cs
index 3ea73175..199adba6 100644
--- a/Source/MQTTnet/Client/Receiving/IMqttApplicationMessageReceivedHandler.cs
+++ b/Source/MQTTnet/Client/Receiving/IMqttApplicationMessageReceivedHandler.cs
@@ -4,6 +4,11 @@ namespace MQTTnet.Client.Receiving
{
public interface IMqttApplicationMessageReceivedHandler
{
+ ///
+ /// Handles the application message received event.
+ ///
+ /// The event args.
+ /// A representing any asynchronous operation.
Task HandleApplicationMessageReceivedAsync(MqttApplicationMessageReceivedEventArgs eventArgs);
}
}
diff --git a/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeOptions.cs b/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeOptions.cs
index 42c38e11..2c43c42a 100644
--- a/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeOptions.cs
+++ b/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeOptions.cs
@@ -5,10 +5,28 @@ namespace MQTTnet.Client.Subscribing
{
public class MqttClientSubscribeOptions
{
+ ///
+ /// Gets or sets a list of topic filters the client wants to subscribe to.
+ /// Topic filters can include regular topics or wild cards.
+ ///
public List TopicFilters { get; set; } = new List();
+ ///
+ /// Gets or sets the subscription identifier.
+ /// The client can specify a subscription identifier when subscribing.
+ /// The broker will establish and store the mapping relationship between this subscription and subscription identifier when successfully create or modify subscription.
+ /// The broker will return the subscription identifier associated with this PUBLISH packet and the PUBLISH packet to the client when need to forward PUBLISH packets matching this subscription to this client.
+ /// Hint: MQTT 5 feature only.
+ ///
public uint? SubscriptionIdentifier { get; set; }
+ ///
+ /// Gets or sets the user properties.
+ /// In MQTT 5, user properties are basic UTF-8 string key-value pairs that you can append to almost every type of MQTT packet.
+ /// As long as you don’t exceed the maximum message size, you can use an unlimited number of user properties to add metadata to MQTT messages and pass information between publisher, broker, and subscriber.
+ /// The feature is very similar to the HTTP header concept.
+ /// Hint: MQTT 5 feature only.
+ ///
public List UserProperties { get; set; }
}
}
diff --git a/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeOptionsBuilder.cs b/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeOptionsBuilder.cs
index 97b5b776..96e6c5d1 100644
--- a/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeOptionsBuilder.cs
+++ b/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeOptionsBuilder.cs
@@ -9,6 +9,13 @@ namespace MQTTnet.Client.Subscribing
{
private readonly MqttClientSubscribeOptions _subscribeOptions = new MqttClientSubscribeOptions();
+ ///
+ /// Adds the user property to the subscribe options.
+ /// Hint: MQTT 5 feature only.
+ ///
+ /// The property name.
+ /// The property value.
+ /// A new instance of the class.
public MqttClientSubscribeOptionsBuilder WithUserProperty(string name, string value)
{
if (name == null) throw new ArgumentNullException(nameof(name));
@@ -24,13 +31,26 @@ namespace MQTTnet.Client.Subscribing
return this;
}
+ ///
+ /// Adds the subscription identifier to the subscribe options.
+ ///
+ /// The subscription identifier.
+ /// A new instance of the class.
public MqttClientSubscribeOptionsBuilder WithSubscriptionIdentifier(uint? subscriptionIdentifier)
{
_subscribeOptions.SubscriptionIdentifier = subscriptionIdentifier;
-
return this;
}
+ ///
+ /// Adds a topic filter to the subscribe options.
+ ///
+ /// The topic.
+ /// The quality of service level.
+ /// A value indicating whether to not send messages originating on this client (noLocal) or not.
+ /// A value indicating whether messages are retained as published or not.
+ /// The retain handling.
+ /// A new instance of the class.
public MqttClientSubscribeOptionsBuilder WithTopicFilter(
string topic,
MqttQualityOfServiceLevel qualityOfServiceLevel = MqttQualityOfServiceLevel.AtMostOnce,
@@ -48,6 +68,11 @@ namespace MQTTnet.Client.Subscribing
});
}
+ ///
+ /// Adds the topic filter to the subscribe options.
+ ///
+ /// The topic filter builder.
+ /// A new instance of the class.
public MqttClientSubscribeOptionsBuilder WithTopicFilter(Action topicFilterBuilder)
{
if (topicFilterBuilder == null) throw new ArgumentNullException(nameof(topicFilterBuilder));
@@ -58,6 +83,11 @@ namespace MQTTnet.Client.Subscribing
return WithTopicFilter(internalTopicFilterBuilder);
}
+ ///
+ /// Adds the topic filter to the subscribe options.
+ ///
+ /// The topic filter builder.
+ /// A new instance of the class.
public MqttClientSubscribeOptionsBuilder WithTopicFilter(MqttTopicFilterBuilder topicFilterBuilder)
{
if (topicFilterBuilder == null) throw new ArgumentNullException(nameof(topicFilterBuilder));
@@ -65,6 +95,11 @@ namespace MQTTnet.Client.Subscribing
return WithTopicFilter(topicFilterBuilder.Build());
}
+ ///
+ /// Adds the topic filter to the subscribe options.
+ ///
+ /// The topic filter.
+ /// A new instance of the class.
public MqttClientSubscribeOptionsBuilder WithTopicFilter(MqttTopicFilter topicFilter)
{
if (topicFilter == null) throw new ArgumentNullException(nameof(topicFilter));
@@ -79,6 +114,10 @@ namespace MQTTnet.Client.Subscribing
return this;
}
+ ///
+ /// Builds the subscription options.
+ ///
+ /// A new instance of the class.
public MqttClientSubscribeOptions Build()
{
return _subscribeOptions;
diff --git a/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeResultItem.cs b/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeResultItem.cs
index 65f15c43..3e2d27f1 100644
--- a/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeResultItem.cs
+++ b/Source/MQTTnet/Client/Subscribing/MqttClientSubscribeResultItem.cs
@@ -10,8 +10,16 @@ namespace MQTTnet.Client.Subscribing
ResultCode = resultCode;
}
+ ///
+ /// Gets or sets the topic filter.
+ /// The topic filter can contain topics and wildcards.
+ ///
public MqttTopicFilter TopicFilter { get; }
+ ///
+ /// Gets or sets the result code.
+ /// Hint: MQTT 5 feature only.
+ ///
public MqttClientSubscribeResultCode ResultCode { get; }
}
}
diff --git a/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeOptions.cs b/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeOptions.cs
index 73c21ef7..09a4ce29 100644
--- a/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeOptions.cs
+++ b/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeOptions.cs
@@ -5,8 +5,19 @@ namespace MQTTnet.Client.Unsubscribing
{
public class MqttClientUnsubscribeOptions
{
+ ///
+ /// Gets or sets a list of topic filters the client wants to unsubscribe from.
+ /// Topic filters can include regular topics or wild cards.
+ ///
public List TopicFilters { get; set; } = new List();
+ ///
+ /// Gets or sets the user properties.
+ /// In MQTT 5, user properties are basic UTF-8 string key-value pairs that you can append to almost every type of MQTT packet.
+ /// As long as you don’t exceed the maximum message size, you can use an unlimited number of user properties to add metadata to MQTT messages and pass information between publisher, broker, and subscriber.
+ /// The feature is very similar to the HTTP header concept.
+ /// Hint: MQTT 5 feature only.
+ ///
public List UserProperties { get; set; } = new List();
}
}
diff --git a/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeOptionsBuilder.cs b/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeOptionsBuilder.cs
index 85162435..56a1997e 100644
--- a/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeOptionsBuilder.cs
+++ b/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeOptionsBuilder.cs
@@ -8,6 +8,13 @@ namespace MQTTnet.Client.Unsubscribing
{
private readonly MqttClientUnsubscribeOptions _unsubscribeOptions = new MqttClientUnsubscribeOptions();
+ ///
+ /// Adds the user property to the unsubscribe options.
+ /// Hint: MQTT 5 feature only.
+ ///
+ /// The property name.
+ /// The property value.
+ /// A new instance of the class.
public MqttClientUnsubscribeOptionsBuilder WithUserProperty(string name, string value)
{
if (name is null) throw new ArgumentNullException(nameof(name));
@@ -16,6 +23,12 @@ namespace MQTTnet.Client.Unsubscribing
return WithUserProperty(new MqttUserProperty(name, value));
}
+ ///
+ /// Adds the user property to the unsubscribe options.
+ /// Hint: MQTT 5 feature only.
+ ///
+ /// The user property.
+ /// A new instance of the class.
public MqttClientUnsubscribeOptionsBuilder WithUserProperty(MqttUserProperty userProperty)
{
if (userProperty is null) throw new ArgumentNullException(nameof(userProperty));
@@ -30,6 +43,11 @@ namespace MQTTnet.Client.Unsubscribing
return this;
}
+ ///
+ /// Adds the topic filter to the unsubscribe options.
+ ///
+ /// The topic.
+ /// A new instance of the class.
public MqttClientUnsubscribeOptionsBuilder WithTopicFilter(string topic)
{
if (topic is null) throw new ArgumentNullException(nameof(topic));
@@ -44,6 +62,11 @@ namespace MQTTnet.Client.Unsubscribing
return this;
}
+ ///
+ /// Adds the topic filter to the unsubscribe options.
+ ///
+ /// The topic filter.
+ /// A new instance of the class.
public MqttClientUnsubscribeOptionsBuilder WithTopicFilter(MqttTopicFilter topicFilter)
{
if (topicFilter is null) throw new ArgumentNullException(nameof(topicFilter));
@@ -51,6 +74,10 @@ namespace MQTTnet.Client.Unsubscribing
return WithTopicFilter(topicFilter.Topic);
}
+ ///
+ /// Builds the unsubscription options.
+ ///
+ /// A new instance of the class.
public MqttClientUnsubscribeOptions Build()
{
return _unsubscribeOptions;
diff --git a/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeResultItem.cs b/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeResultItem.cs
index 755ee43c..065fb7f2 100644
--- a/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeResultItem.cs
+++ b/Source/MQTTnet/Client/Unsubscribing/MqttClientUnsubscribeResultItem.cs
@@ -10,8 +10,16 @@ namespace MQTTnet.Client.Unsubscribing
ReasonCode = reasonCode;
}
+ ///
+ /// Gets or sets the topic filter.
+ /// The topic filter can contain topics and wildcards.
+ ///
public string TopicFilter { get; }
+ ///
+ /// Gets or sets the result code.
+ /// Hint: MQTT 5 feature only.
+ ///
public MqttClientUnsubscribeResultCode ReasonCode { get; }
}
}
\ No newline at end of file
diff --git a/Source/MQTTnet/IApplicationMessagePublisher.cs b/Source/MQTTnet/IApplicationMessagePublisher.cs
index bf17718c..aa3caae7 100644
--- a/Source/MQTTnet/IApplicationMessagePublisher.cs
+++ b/Source/MQTTnet/IApplicationMessagePublisher.cs
@@ -6,6 +6,12 @@ namespace MQTTnet
{
public interface IApplicationMessagePublisher
{
+ ///
+ /// Publishes a new application message to the server.
+ ///
+ /// The application message.
+ /// A cancellation token to stop the task.
+ /// A representing any asynchronous operation.
Task PublishAsync(MqttApplicationMessage applicationMessage, CancellationToken cancellationToken);
}
}
diff --git a/Source/MQTTnet/IApplicationMessageReceiver.cs b/Source/MQTTnet/IApplicationMessageReceiver.cs
index 4e474856..a44470d1 100644
--- a/Source/MQTTnet/IApplicationMessageReceiver.cs
+++ b/Source/MQTTnet/IApplicationMessageReceiver.cs
@@ -4,6 +4,10 @@ namespace MQTTnet
{
public interface IApplicationMessageReceiver
{
+ ///
+ /// Gets or sets the application message received handler that is fired every time a new message is received on the client's subscriptions.
+ /// Hint: Initialize handlers before you connect the client to avoid issues.
+ ///
IMqttApplicationMessageReceivedHandler ApplicationMessageReceivedHandler { get; set; }
}
}
diff --git a/Source/MQTTnet/IMqttFactory.cs b/Source/MQTTnet/IMqttFactory.cs
index 8c0e5af3..b68e27a9 100644
--- a/Source/MQTTnet/IMqttFactory.cs
+++ b/Source/MQTTnet/IMqttFactory.cs
@@ -7,8 +7,14 @@ namespace MQTTnet
{
public interface IMqttFactory : IMqttClientFactory, IMqttServerFactory
{
+ ///
+ /// Gets the default logger.
+ ///
IMqttNetLogger DefaultLogger { get; }
+ ///
+ /// Gets the properties.
+ ///
IDictionary