TLS with MQTT-Client C#

Resolved MqttCommunicationException: The client and server cannot communicate, because they do not possess a common algorithm

var factory = new MqttFactory();
var client = factory.CreateMqttClient();
var options = new MqttClientOptionsBuilder()
          .WithTcpServer(config["HostName"], int.Parse(config["PortNumber"]))
          .WithCredentials(config["UserName"], config["Password"])
          .WithTls(new MqttClientOptionsBuilderTlsParameters()
                UseTls = true,
                SslProtocol = SslProtocols.Tls12


Since March 2011, have 8+ years of professional experience on software development, currently working as Senior Software Engineer at s3 Innovate Pte Ltd.

Leave a Reply