OpcLabs.MqttNet communication package: Difference between revisions

From OPC Labs Knowledge Base
No edit summary
No edit summary
Line 2: Line 2:
This communication package is based on MQTTnet and MQTTnet.Extensions.ManagedClient libraries by Christian Kratky. See [[MQTT communication packages]] for a summary of the communication package and the library. The library support Client and Server roles; the communication package only supports the Client role.
This communication package is based on MQTTnet and MQTTnet.Extensions.ManagedClient libraries by Christian Kratky. See [[MQTT communication packages]] for a summary of the communication package and the library. The library support Client and Server roles; the communication package only supports the Client role.


The type name of the message channel object is {{Style=Identifier|OpcLabs.MqttNet.ManagedMqttClientMessageChannel,OpcLabs.MqttNet}}. See [[Using communication packages]] for instructions on how to select the communication package, and configure it.
See [[Using communication packages]] for instructions on how to select the communication package, and configure it. The type name of the message channel object is:
== URL syntax ==
'''{{Style=Identifier|OpcLabs.MqttNet.ManagedMqttClientMessageChannel,OpcLabs.MqttNet}}''' .
== URL string ==
If the URL scheme has "mqtt", "mqtts", "ssl" or "tcp" scheme, TCP protocol (possibly with TLS) will be used. In this case, the URL is parsed by the communication package and various pieces of information are extracted from it.
 
== Configuration ==
== Configuration ==
The table below lists the available properties, their types, and descriptions. Most properties come from configurable options of the underlying library, so please refer to the its documentation for details (we could not find a comprehensive reference documentation for this library, that's why most descriptions are missing). Do not get scared by the number of configurable properties; the relevant ones can usually stay at their defaults, or usually overridden from the host software (as noted). We will emphasize specific properties if they are important.
The table below lists the available properties, their types, and descriptions. Most properties come from configurable options of the underlying library, so please refer to the its documentation for details (we could not find a comprehensive reference documentation for this library, that's why most descriptions are missing). Do not get scared by the number of configurable properties; the relevant ones can usually stay at their defaults, or usually overridden from the host software (as noted). We will emphasize specific properties if they are important.

Revision as of 08:41, 13 December 2019

This communication package is based on MQTTnet and MQTTnet.Extensions.ManagedClient libraries by Christian Kratky. See MQTT communication packages for a summary of the communication package and the library. The library support Client and Server roles; the communication package only supports the Client role.

See Using communication packages for instructions on how to select the communication package, and configure it. The type name of the message channel object is: OpcLabs.MqttNet.ManagedMqttClientMessageChannel,OpcLabs.MqttNet .

URL string

If the URL scheme has "mqtt", "mqtts", "ssl" or "tcp" scheme, TCP protocol (possibly with TLS) will be used. In this case, the URL is parsed by the communication package and various pieces of information are extracted from it.

Configuration

The table below lists the available properties, their types, and descriptions. Most properties come from configurable options of the underlying library, so please refer to the its documentation for details (we could not find a comprehensive reference documentation for this library, that's why most descriptions are missing). Do not get scared by the number of configurable properties; the relevant ones can usually stay at their defaults, or usually overridden from the host software (as noted). We will emphasize specific properties if they are important.

Property Type Description
ClientWaitTimeout System.Int32 Determines the maximum wait time for the client to open before publishing a message. In milliseconds.
ManagedMqttClientOptions MQTTnet.Extensions.ManagedClient.ManagedMqttClientOptions
ManagedMqttClientOptions.AutoReconnectDelay System.TimeSpan Default is 5 seconds.
ManagedMqttClientOptions.ClientOptions MQTTnet.Client.Options.IMqttClientOptions
ManagedMqttClientOptions.ConnectionCheckInterval System.TimeSpan Default is 1 second.
ManagedMqttClientOptions.MaxPendingMessages System.Int32 Default is 2^31-1.
ManagedMqttClientOptions.PendingMessagesOverflowStrategy MQTTnet.Server.MqttPendingMessagesOverflowStrategy Default is DropNewMessage.
ManagedMqttClientOptions.Storage MQTTnet.Extensions.ManagedClient.IManagedMqttClientStorage
MqttClientOptions MQTTnet.Client.Options.MqttClientOptions
MqttClientOptions.AuthenticationData System.Byte[]
MqttClientOptions.AuthenticationMethod System.String
MqttClientOptions.ChannelOptions MQTTnet.Client.Options.IMqttClientChannelOptions Default value is null. For known URL schemes, it gets overridden by a value determined during URL resolution. For "mqtt", "mqtts", "ssl", "tcp" schemes, value from the MqttClientTcpOptions property is used. For "ws", "wss" schemes, value from the MqttClientWebSocketOptions is used.
MqttClientOptions.CleanSession System.Boolean Always gets set to the value specified by the host software (do not use).
MqttClientOptions.ClientId System.String Default value is null. When null, gets overridden by the ClientId specified by the host software. For "mqtt", "mqtts", "ssl", "tcp" URL schemes, it can further be overridden by a "clientId" query parameter in the URL.
MqttClientOptions.Credentials MQTTnet.Client.Options.IMqttClientCredentials Default value is null. When null, for "mqtt", "mqtts", "ssl", "tcp" URL schemes, if the URL contains user-specific information, gets overridden by the credentials with user name and password from the URL.
MqttClientOptions.CommunicationTimeout System.Timespan Default is 10 seconds.
MqttClientOptions.ExtendedAuthenticationExchangeHandler MQTTnet.Client.ExtendedAuthenticationExchange.IMqttExtendedAuthenticationExchangeHandler
MqttClientOptions.KeepAlivePeriod System.Timespan Default is 15 seconds.
MqttClientOptions.KeepAliveSendInterval System.Nullable<System.TimeSpan>
MqttClientOptions.MaximumPacketSize System.Nullable<System.UInt32>
MqttClientOptions.ProtocolVersion MQTTnet.Formatter.MqttProtocolVersion Default is V311.
MqttClientOptions.ReceiveMaximum System.Nullable<UInt16>
MqttClientOptions.RequestProblemInformation System.Nullable<System.Boolean>
MqttClientOptions.RequestResponseInformation System.Nullable<System.Boolean>
MqttClientOptions.SessionExpiryInterval System.Nullable<System.UInt32>
MqttClientOptions.TopicAliasMaximum System.Nullable<System.UInt16>
MqttClientOptions.WillDelayInterval System.Nullable<System.UInt16>
MqttClientTcpOptions MQTTnet.Client.Options.MqttClientTcpOptions
MqttClientTcpOptions.AddressFamily System.Net.Sockets.AddressFamily Default is Unspecified.
MqttClientTcpOptions.BufferSize System.Int32 Default is 65536.
MqttClientTcpOptions.DualMode System.Nullable<System.Boolean>
MqttClientTcpOptions.NoDelay System.Boolean
MqttClientTcpOptions.Port System.Nullable<System.Int32> For "mqtt", "tcp" URL schemes, gets overridden by the value specified in the URL, or 1883 if not specified. For "mqtts", "ssl" URL schemes, gets overridden by the value specified in the URL, or 8883 if not specified.
MqttClientTcpOptions.Server System.String
MqttClientTcpOptions.TlsOptions MQTTnet.Client.Options.MqttClientTlsOptions For "mqtt", "tcp", "mqtts", "ssl" URL schemes, some sub-properties (described here) get overridden.
MqttClientTcpOptions.TlsOptions.AllowUntrustedCertificates System.Boolean
MqttClientTcpOptions.TlsOptions.Certificates System.List<System.Security.Cryptography.X509Certificates.X509Certificate> (.NET Framework)
System.List<System.Byte[]> (.NET Standard)
For "mqtts", "ssl" URL schemes, may get overridden by hosting software.
MqttClientTcpOptions.TlsOptions.CertificateValidationCallback System.Func<System.Security.Cryptography.X509Certificates.X509Certificate, System.Security.Cryptography.X509Certificates.X509Chain, System.Net.Security.SslPolicyErrors, MQTTnet.Client.Options.IMqttClientOptions, System.Boolean> For "mqtts", "ssl" URL schemes, may get overridden by hosting software.
MqttClientTcpOptions.TlsOptions.IgnoreCertificateChainErrors System.Boolean
MqttClientTcpOptions.TlsOptions.IgnoreCertificateRevocationErrors System.Boolean
MqttClientTcpOptions.TlsOptions.SslProtocol System.Security.Authentication.SslProtocols Default is Tls12.
MqttClientTcpOptions.TlsOptions.UseTls System.Boolean Gets set to false for "mqtt", "tcp" URL schemes, gets set to true for "mqtts", "ssl" URL scheme.
MqttClientWebSocketOptions MQTTnet.Client.Options.MqttClientWebSocketOptions
MqttClientWebSocketOptions.CookieContainer System.Net.CookieContainer
MqttClientWebSocketOptions.ProxyOptions MQTTnet.Client.Options.MqttClientWebSocketProxyOptions
MqttClientWebSocketOptions.RequestHeaders System.Collections.Generic.IDictionary<System.String, System.String>
MqttClientWebSocketOptions.SubProtocols System.Collections.Generic.ICollection<System.String> Default is { "mqtt" }.
MqttClientWebSocketOptions.TlsOptions MQTTnet.Client.Options.MqttClientTlsOptions For "ws", "wss" URL schemes, some sub-properties (described here) get overridden.
MqttClientWebSocketOptions.TlsOptions.AllowUntrustedCertificates System.Boolean
MqttClientWebSocketOptions.TlsOptions.Certificates System.List<System.Security.Cryptography.X509Certificates.X509Certificate> (.NET Framework)
System.List<System.Byte[]> (.NET Standard)
For "wss" URL scheme, may get overridden by hosting software.
MqttClientWebSocketOptions.TlsOptions.CertificateValidationCallback System.Func<System.Security.Cryptography.X509Certificates.X509Certificate, System.Security.Cryptography.X509Certificates.X509Chain, System.Net.Security.SslPolicyErrors, MQTTnet.Client.Options.IMqttClientOptions, System.Boolean> For "wss" URL scheme, may get overridden by hosting software.
MqttClientWebSocketOptions.TlsOptions.IgnoreCertificateChainErrors System.Boolean
MqttClientWebSocketOptions.TlsOptions.IgnoreCertificateRevocationErrors System.Boolean
MqttClientWebSocketOptions.TlsOptions.SslProtocol System.Security.Authentication.SslProtocols Default is Tls12.
MqttClientWebSocketOptions.TlsOptions.UseTls System.Boolean Gets set to false for "ws" URL scheme, gets set to true for "wss" URL scheme.
MqttClientWebSocketOptions.Uri System.String For "ws", "wss" URL schemes, gets overridden by the input URL string.