title: Socket.io how to store more information that is common to room's users?
body: <p>I'm developing a game using socket.io &amp; nodejs. Two players get a set of boxes, which is an array, when they're done with what they had and I'm keeping record of how many set is requested.</p>
  
  <p>The thing is I want to send request count to both players in the room whenever a request has been made. I can hold this info in database but that would be very inefficient, it's a real-time multiplayer game.</p>
  
  <p>Because I have to emit both player's box count to the room, I thought having their box count in the room array would help but couldn't figure out. Just to give an idea:</p>
  
  <p>In socket.io rooms hold info as this:</p>
  
  <pre><code>{ someUniqueSocketId : true, someAnotherSocketId : true}
  </code></pre>
  
  <p>I want it to hold like this:</p>
  
  <pre><code>{someUniqueSocketId : {setCountOfThisPlayer : true} ,
   someAnotherSocketId : {setCountOfThatPlayer : true}}
  </code></pre>
  
  <p>Or maybe there is a better way to hold such an info.</p>
  
  <p>EDIT:</p>
  
  <p>When a player sends a startGame signal, this works:</p>
  
  <pre><code>function startGame(){
      this.setCount = 0;
      io.to(matchRoom).emit('allSets', allSets);
  };
  </code></pre>
  
  <p>allSets is an array of all boxes. It <strong>holds box count as property of the socket by this.setCount.</strong> But I cannot access other player's properties, so this doesn't work.</p>