title: Socket.io client how to know if user is connected to a channel
body: <p>In Mysocket i have a list of available "rooms" that the user is able to <em>subscribe</em>, and <em>unsubscribe</em>. The user can subscribe and unsubscribe to different rooms in the same view .</p>
  
  <p>I've tried to solve this with this method, but the issue is that the socket is updating every <em>room</em> with the current event ( 'subscribe' or 'unsubscribe' ) not just the ones that are needed. I have an object that handles the state of the socket:</p>
  
  <pre><code>const rooms = {
              1: {  id: 1, isConnected: true },
              2: {  id: 2, isConnected: true },
              3: {  id: 3, isConnected: false
              }
            };
  
  subscribeSocketLive( rooms ){
      _.each(rooms , room =&gt; {
          if(room.isConnected ){
            mySocket.emit('subscribe',  Number( room.id ) );
        }
        else if( !room.isConnected ){
          mySocket.emit('unsubscribe',  Number( room.id ) );
        }
      });
    },
  </code></pre>
  
  <p>I am handling the object rooms in a separate file depending on the interaction of the user. So i think that this isnt important but if you need more info, i can post it here.</p>