title: Aedes and MQTT broker/publisher/subscriber
body: <p>In my project I am trying to have multiple Raspberry Pi devices as &quot;publishers&quot; with one broker in the middle and countless subscribers to get info from certain topics.</p>
  <p>I am having problems with connecting broker and publisher, it just stops on <code>console.log(&quot;Before connection&quot;)</code> and is unwilling to go further.</p>
  <p>Broker:</p>
  <pre><code>const aedes = require('aedes')
  const server = require('net').createServer(aedes.handle)
  const port = 1883
  
  server.listen(port, function() {
      console.log('Server je pokrenut na portu ', port)
  })
  </code></pre>
  <p>Publisher:</p>
  <pre><code>const mqtt = require('mqtt');
  const client = mqtt.connect('mqtt://127.0.0.1:1883')
  console.log(&quot;Before connection&quot;)
  client.on(&quot;connect&quot;, function () {
      console.log(&quot;Connected before interval&quot;)
      setInterval(function () {
          console.log(&quot;Before publish&quot;)
          client.publish('NameOfTopic', 'Hello mqtt');
          console.log('Message Sent');
          
      }, 5000);
  });
  </code></pre>
  <p>I know something is happening because when I kill publisher, broker gets also killed with error event on Socket instance, error number -4077, code econnreset</p>