title: In MQTT client " Uncaught ReferenceError: Messaging is not defined"
body: <p>I am trying simple websocket based MQTT client and having  "Uncaught ReferenceError: Messaging is not defined" error on console of Chrome.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;head&gt;
  
    &lt;head&gt;
    &lt;script src="mqttws31.js" type="text/javascript" charset="utf-8" async defer&gt;&lt;/script&gt;
  
  
    &lt;script type="text/javascript"&gt;
  
    var client;
    var form = document.getElementById("tutorial");
  
    function doConnect() {
          var wsbroker = "test.mosquitto.org";  //mqtt websocket enabled broker
      var wsport = 80 // port for above
  
      var client = new Messaging.Client(wsbroker, wsport,
          "myclientid_" + parseInt(Math.random() * 100, 10));
        client.onConnect = onConnect;
        client.onMessageArrived = onMessageArrived;
        client.onConnectionLost = onConnectionLost;
        client.connect({onSuccess:onConnect});
    }
  
    function doSubscribe() {
        client.subscribe("/World");
    }
  
    function doSend() {
        message = new Messaging.Message("Hello");
        message.destinationName = "/World";
        client.send(message);
    }
  
    function doDisconnect() {
        client.disconnect();
    }
  
    // Web Messaging API callbacks
  
    function onConnect() {
        var form = document.getElementById("example");
        form.connected.checked= true;
    }
  
    function onConnectionLost(responseObject) {
        var form = document.getElementById("example");
        form.connected.checked= false;
        if (responseObject.errorCode !== 0)
            alert(client.clientId+"\n"+responseObject.errorCode);
    }
  
    function onMessageArrived(message) {
        var form = document.getElementById("example");
        form.receiveMsg.value = message.payloadString;
    }
  
    &lt;/script&gt;
  &lt;/head&gt; 
  
  &lt;body&gt;
    &lt;h1&gt;Example Web Messaging web page.&lt;/h1&gt;
    &lt;form id="example"&gt;
    &lt;fieldset&gt;
    &lt;legend id="Connect" &gt; Connect &lt;/legend&gt;
      Make a connection to the server, and set up a call back used if a 
      message arrives for this client.
      &lt;br&gt;
      &lt;input type="button" value="Connect" onClick="doConnect(this.form)" name="Connect"/&gt;
      &lt;input type="checkbox" name="connected" disabled="disabled"/&gt;
    &lt;/fieldset&gt;
  
    &lt;fieldset&gt;
    &lt;legend id="Subscribe" &gt; Subscribe &lt;/legend&gt;
    Make a subscription to topic "/World".
    &lt;br&gt; &lt;input type="button" value="Subscribe" onClick="doSubscribe(this.form)"/&gt;
    &lt;/fieldset&gt;
  
    &lt;fieldset&gt;
    &lt;legend id="Send" &gt; Send &lt;/legend&gt;
      Create a Message object containing the word "Hello" and then publish it at
      the server.
      &lt;br&gt;
      &lt;input type="button" value="Send" onClick="doSend(this.form)"/&gt;
    &lt;/fieldset&gt;
  
    &lt;fieldset&gt;
    &lt;legend id="Receive" &gt; Receive &lt;/legend&gt;
      A copy of the published Message is received in the callback we created earlier.
    &lt;textarea name="receiveMsg" rows="1" cols="40" disabled="disabled"&gt;&lt;/textarea&gt;
    &lt;/fieldset&gt;
  
    &lt;fieldset&gt;
    &lt;legend id="Disconnect" &gt; Disconnect &lt;/legend&gt;
      Now disconnect this client from the server.
    &lt;br&gt; &lt;input type="button" value="Disconnect" onClick="doDisconnect()"/&gt;
    &lt;/fieldset&gt;
    &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html --&gt;
  </code></pre>
  
  <p>ERROR is on line " var client = new Messaging.Client(wsbroker, wsport,"</p>
  
  <p>Error os "Uncaught ReferenceError: Messaging is not defined"</p>
  
  <p>The java Script is from <a href="http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.javascript.git/tree/src/mqttws31.js" rel="nofollow">http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.javascript.git/tree/src/mqttws31.js</a></p>
  
  <p>Please suggest any solution...</p>