title: socket.io leave current room and join after button is clicked
body: <p>my question is about socket rooms and leave and joining in rooms .my problem is that : i am creating chatroom and i want whenever user (socket) clicks "next person"  button (in my case link)  i want socket to disconnect (leave) its current room and join another one where another socket is waiting for second socket.    like in <em>Omegle</em></p>
  
  <h1>Heading</h1>
  
  <p>so i tried this code</p>
  
  <p>client-side: </p>
  
  <pre><code> N.addEventListener('click', function(e){
                   socket.emit('next')
  
  });
  
  socket.on('next',function(){
  socket.disconnect()
  document.GetElementById('divd').style.display = "inline";
  socket.connect()
  });
  </code></pre>
  
  <p>server-side: </p>
  
  <pre><code>       socket.on('next', function(){
          socket.leave(socket.current_room)
          chnm.in(socket.current_room).emit('next');
          socket.join(room)
          });
  </code></pre>
  
  <p>but whenever i click "next" it only shows both socket disconnect div like in disconnect event but does not lets socket which triggered that event to join other room 
   rooms in my case is like that</p>
  
  <pre><code>   var room = "room" + numb;
     socket.current_room = room;
  </code></pre>
  
  <p>but what i want is to show in room (where socket disconnected) that socket disconnected and socket which triggered that event to be joined in other room . 
  (example: in room 1 socket triggered "next" link   he/she disconnects from the room 1 and joins to room 2  and in room 1 appears disconnect div, i think it will appear anyway if i use socket.disconnect() because i already created disconnect event . thanks guys for help &lt;3 </p>