why do we need setTimeout to close the connection in rabbitMQ with javascript
<p>I am using rabbitMQ with javascript. With all the examples provided by rabbitMQ are closing the connection using setTimeout of around 500ms. When I tried colsing connection with any delay then the things didn't workout.</p>

<pre><code>var amqp = require('amqplib/callback_api');
amqp.connect('amqp://localhost', function(err, conn) {
  conn.createChannel(function(err, ch) {
    var ex = 'logs';
    var msg = process.argv.slice(2).join(' ') || 'Hello World!';

    ch.assertExchange(ex, 'fanout', {durable: false});
    ch.publish(ex, '', new Buffer(msg));
    console.log(" [x] Sent %s", msg);
  });
</code></pre>

<blockquote>
  <p>setTimeout(function() { conn.close(); process.exit(0) }, 500);</p>
</blockquote>

<pre><code>});
</code></pre>