title: Send private message using Node.js and Socket.io
body: <p>I am implementing a small chat application using node.js and socket.io. Everything goes well till I try to send a private message. Here is the code for the server:</p>
  
  <pre><code>...
  var to = users[name];
  socket.to(to).emit('private message', {userName: socket.username, message: msg} );
  ...
  </code></pre>
  
  <p>Code on the client side:</p>
  
  <pre><code>...
  socket.on('private message', function(data){
      alert(data.message);
  });
  ...
  </code></pre>
  
  <p>My problem is that on the client side the event is never fired, can anyone help me to fix this issue? Thank you.</p>