title: websocket and cloudmqtt, code example not working
body: <p>is it possible to work with websockets and <a href="http://www.cloudmqtt.com" rel="nofollow">cloudmqtt</a>?
  I have following code but nothing is working.
  First I use the mqttw31.js from Paho and in my host file I define all the connection details.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>src="js/mqttws31.js" type="text/javascript"&gt;
  src="js/host.js" type="text/javascript"&gt;                                                                        
  var mqtt;
  var reconnectTimeout = 2000;
  function MQTTconnect() {
  mqtt = new Paho.MQTT.Client(
                              host,
                              port,
                              "web_" + parseInt(Math.random() * 100,
                              10));
  var options = {
       timeout: 3,
       useSSL: useTLS,
       cleanSession: cleansession,
       onSuccess: onConnect,
       onFailure: function (message) {
         $('#status').val("Connection failed: " + message.errorMessage + "Retrying");
         setTimeout(MQTTconnect, reconnectTimeout);
       }
  };
  mqtt.onConnectionLost = onConnectionLost;
  mqtt.onMessageArrived = onMessageArrived;
  if (username != null) {
      options.userName = username;
      options.password = password;
  }
  console.log("Host="+ host + ", port=" + port + " TLS = " + useTLS + " username=" + username + " password=" + password);
  mqtt.connect(options);
  }
  function onConnect() {
      $('#status').val('Connected to ' + host + ':' + port);
      // Connection succeeded; subscribe to our topic
      mqtt.subscribe(topic, {qos: 0});
      $('#topic').val(topic);
      mqtt.publish("/arduino/commando/", "test Intel");
  }
  function onConnectionLost(response) {
      setTimeout(MQTTconnect, reconnectTimeout);
      $('#status').val("connection lost: " + responseObject.errorMessage + ". Reconnecting");
  };
  function onMessageArrived(message) {
      var topic = message.destinationName;
      var payload = message.payloadString;
      $('#ws').prepend('&lt;li&gt;' + topic + ' = ' + payload + '&lt;/li&gt;');
  };
  $(document).ready(function() {
  MQTTconnect();
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;header&gt;
  &lt;h2&gt;MQTT Test&lt;/h2&gt;
  &lt;/header&gt;
  &lt;div&gt;
  Subscribed to &lt;input type='text' id='topic' disabled /&gt;
  Status: &lt;input type='text' id='status' size="80" disabled /&gt;
  &lt;ul id='ws' style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;/ul&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>In the host file:</p>
  
  <pre><code>host = 'm20.cloudmqtt.com'; // hostname or IP address
  port = 13365;
  topic = '/arduino/status/';     // topic to subscribe to
  useTLS = false;
  username = "test";
  password = "test";
  cleansession = true;
  </code></pre>