title: Socket.io callback is not a function error
body: <p>I was trying to use callbacks in my socket.io application but for some reason, it doesn't accept my callback function and throws an error with message <code>TypeError: callback is not a function</code>. I don't know why my application throws this error. I compare my code with socket.io's documentation on <em>Socket.io Acknowledgements</em>. They look the same but somehow my code is not working. Can you spot the problem, please?</p>
  <p>This is the example code from Socket.io's documentation on <em>acknowledgements (callbacks)</em>:</p>
  <p><a href="https://i.stack.imgur.com/avVrS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/avVrS.png" alt="Socket.io documentation" /></a></p>
  <p>My current code on server side:</p>
  <pre class="lang-js prettyprint-override"><code>io.on('connection', (socket) =&gt; {
      debug(`${socket.id} connected!`);
  
      socket.on('player joined', (player, callback) =&gt; {
          players.push(player);
          io.emit('update', players);
          callback(true);
      });
  });
  </code></pre>
  <p>My current code on client side:</p>
  <pre class="lang-js prettyprint-override"><code>socket.emit('player joined', player, (isClientReady) =&gt; {
      if(isClientReady) {
          lastRender = 0;
          window.requestAnimationFrame(loop);
      }
  });
  </code></pre>
  <p>Error thrown out by my server side code:</p>
  <p><a href="https://i.stack.imgur.com/2fvGI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2fvGI.png" alt="Error log" /></a></p>
  <p>Thanks in advance!</p>