title: Socket.IO room feature
body: <p>I have two separate files that one is server-side JS.</p>
  
  <p>The other one is dynamically generated client-side PHP.</p>
  
  <p>Those two files are successfully able to communicate each other through Socket.IO.</p>
  
  <p>I understand that I can restrict namespace by using .of() but that cannot be used</p>
  
  <p>to handle dynamically created chat rooms.</p>
  
  <p>So I have decided to use both </p>
  
  <pre><code>.of('/chat') 
  </code></pre>
  
  <p>and the room feature</p>
  
  <pre><code>.join('room name') 
  </code></pre>
  
  <p>I could find server-side example and could not find client-side example with it.</p>
  
  <p>Below is the only given server-side code snippet from <a href="https://github.com/LearnBoost/socket.io/blob/master/Readme.md">Socket.IO github</a></p>
  
  <pre><code>var io = require('socket.io').listen(80);
  
  io.sockets.on('connection', function (socket) {
      socket.join('justin bieber fans');
      socket.broadcast.to('justin bieber fans').emit('new fan');
      io.sockets.in('rammstein fans').emit('new non-fan');
  });
  </code></pre>
  
  <hr>
  
  <h1>1) I'm having trouble understanding below part.</h1>
  
  <pre><code>socket.broadcast.to('justin bieber fans').emit('new fan');
  io.sockets.in('rammstein fans').emit('new non-fan');
  </code></pre>
  
  <p>What is difference between those two? </p>
  
  <h1>2) why not using</h1>
  
  <pre><code>socket.to('room name').emit('event')
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>io.sockets.in('room name').emit('new non-fan');
  </code></pre>
  
  <h1>3) Lastly, I have found some documentation that using</h1>
  
  <pre><code>.send()
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>.emit()
  </code></pre>
  
  <p>Somewhat .send() does not work for me and I want to know difference between those two.</p>
  
  <p>Thanks and I apologize for multiple questions about Socket.IO.</p>