title: Why is MQTT not connecting with NodeJS?
body: <p>I have a weird issue trying to connect to an <code>MQTT</code> server with <code>NODEJS</code>:</p>
  
  <p>If I connect to the <code>MQTT</code> server and I do not get a connect it just hangs.</p>
  
  <p>If I do it with the command line I see data so network, server etc is all good.</p>
  
  <p>If I use a port thats wrong then command line gives me a valid reject message but NODE just hangs.</p>
  
  <p>Command line is:</p>
  
  <pre><code>mosquitto_sub -h 10.10.10.30 -p 1883 -t sim 
  </code></pre>
  
  <p>My code is completely basic:</p>
  
  <pre><code>var mqtt = require('mqtt');
  
  var MQTT_TOPIC          = "sim";
  var MQTT_ADDR           = "10.10.10.30";
  var MQTT_PORT           = 1883;
  var client = mqtt.connect({host: MQTT_ADDR, port : MQTT_PORT, debug: true});
  
  client.on('connect', function() {
      console.log('Connected');
      client.subscribe(MQTT_TOPIC, function() {
          client.on('message', function(topic, message, packet) {
              console.log(topic + ": '" + message);
          });
      });
  });
  </code></pre>