title: Socket.IO acknowledgement vs event emitting
body: <p>I'm trying to build application (to be more accurate a library for my personal projects) which will be based on room management (lobby, matchmaking, rooms, etc).</p>
  
  <p>I managed to do it with socket.io.</p>
  
  <p>Now, my question is, I don't know what kind of design pattern should I use.</p>
  
  <p>I noticed that socket.io has ack callbacks, which surprised me and think it's good, but I'm not sure what's the difference between sending back ack with parameters or emitting an event with parameters.</p>
  
  <p>So, question is, what's the pros and cons using acks over emitting an event and vice-versa?</p>
  
  <p>Let's say, what's the pros and cons using following codes:</p>
  
  <p>assuming handler callback is <code>fn(err, res);</code></p>
  
  <p><strong>acknowledgement style:</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>socket.on('join', function (data, ack) {
    // do the joining stuff here.
    return ack(null, { response: 'goes_here' });
  });
  </code></pre>
  
  <p>versus</p>
  
  <p><strong>event emitting style:</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>socket.on('join', function (data, ack) {
    // do the joining stuff here.
    io.to(client_sid).emit('join_response', null, { response: 'goes_here' });
  });
  </code></pre>