title: C# - Unity3d MQTT - ArgumentException: Library compiled without SSL support
body: <p>folks! I have been working with Unity in order to connect a Unity application for Microsoft Hololens to a server using MQTT protocol. I found a project called <a href="https://github.com/vovacooper/Unity3d_MQTT" rel="nofollow noreferrer">Unity3d MQTT</a>  at Github, which appears to suit my purposes.</p>
  <p>Then, I made a C# script in Unity called MQTTListener. It is written as follows:</p>
  <pre><code>using System.Security.Cryptography.X509Certificates;
  using UnityEngine;
  using uPLibrary.Networking.M2Mqtt;
  using uPLibrary.Networking.M2Mqtt.Messages;
  
  public class MQTTListener : MonoBehaviour{
      private const int port = 8883;
  
      private readonly string deviceId = &quot;&lt;deviceId&gt;&quot;;
      private readonly string hubAddress = &quot;&lt;hubAddress&gt;&quot;;
      private readonly string password = &quot;&lt;sasToken&gt;&quot;;
  
      private MqttClient client;
      private string username;
  
      public TextAsset certificate;
  
      void Start(){
          // Forming a certificate based on a TextAsset
          var cert = new X509Certificate();
          cert.Import(this.certificate.bytes);
  
          // Making a new MQTT client with the formed certificate
          this.client = new MqttClient(
              brokerHostName: this.hubAddress,
              brokerPort: MQTTListener.port,
              secure: true,
              caCert: cert
          );
  
          // Initializing MQTT listener events
          this.client.MqttMsgPublishReceived += Client_MqttMsgPublishReceived;
  
          this.username = &quot;/&quot; + deviceId;
  
          // Establish a connection to the target device
          this.client.Connect(
              clientId: this.deviceId,
              username: this.username,
              password: this.password
          );
  
          var hubTopicSubscribe = &quot;/devices/&quot; + this.deviceId + &quot;/messages/devicebound/#&quot;;
          this.client.Subscribe(
              new string[]{ hubTopicSubscribe },
              new byte[]{ MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE } // QoS = Quality of Service
          );
      }
  
      private void Client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e){
          Debug.Log(&quot;Received: &quot; + System.Text.Encoding.UTF8.GetString(e.Message));
      }
  
      void Update(){
          
      }
  }
  </code></pre>
  <p>The code compiles fine, but then I encountered the following problem:</p>
  <blockquote>
  <p>ArgumentException: Library compiled without SSL support</p>
  <p>uPLibrary.Networking.M2Mqtt.MqttClient.Init (System.String
  brokerHostName, System.Net.IPAddress brokerIpAddress, Int32
  brokerPort, Boolean secure,
  System.Security.Cryptography.X509Certificates.X509Certificate caCert)</p>
  <p>(at Assets/MQTT/scripts/MqttClient.cs:320)
  uPLibrary.Networking.M2Mqtt.MqttClient..ctor (System.String
  brokerHostName, Int32 brokerPort, Boolean secure,
  System.Security.Cryptography.X509Certificates.X509Certificate caCert)
  (at Assets/MQTT/scripts/MqttClient.cs:268) MQTTListener.Start () (at
  Assets/HoloProject/Scripts/MQTTListener.cs:26)</p>
  </blockquote>
  <p>Seems pretty straightforward, but how do actually I compile library (wherever it is) with SSL support?</p>