title: Connecting nodejs and cloud mqtt
body: <p>I am doing a project based on IOT. So I need to connect <code>cloudmqtt</code> and <code>nodejs</code> server.</p>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>// Create a MQTT Client
  var mqtt = require('mqtt');
  
  // Create a client connection to CloudMQTT for live data
  var client = mqtt.connect('xxxxxxxxxxx', {
    username: 'xxxxx',
    password: 'xxxxxxx' 
  });
  
  client.on('connect', function() { // When connected
      console.log("Connected to CloudMQTT");
    // Subscribe to the temperature
    client.subscribe('Motion', function() {
      // When a message arrives, do something with it
      client.on('message', function(topic, message, packet) {
        // ** Need to pass message out **
      });
    });
  
  });
  </code></pre>
  
  <p>Then started my server. But nothing is happening(No error message and no warning).Please help me on this?</p>