title: Sending array from server to client with socket.io
body: <p>I am developing a small chat app, and I would like to be able to display a list of connected users.
  To do so, on my server side, I have:</p>
  
  <pre><code>var users = {};
  
      io.on('connection', function(socket){
          socket.on('newUser', function(pseudo) {
              socket.pseudo = pseudo;
              users[socket.pseudo] = socket;
              io.sockets.emit('newUser', pseudo);
              console.log(Object.keys(users));
          });
  </code></pre>
  
  <p>The console sends me back <code>[ 'root' ]</code> if I connect the user root.
  And this is what I have on my client side:</p>
  
  <pre><code>var pseudo = '#{user.username}';
  socket.emit('newUser', pseudo);
  
      socket.on('newUser', function(pseudo) {
          $('#messageZone').append('&lt;p&gt;&lt;em&gt;' + pseudo + ' just joined the conversation !&lt;/em&gt;&lt;/p&gt;');
      });
  </code></pre>
  
  <p>So my question is, how can I send the full updated <code>users</code> array to each client when they connect themselves and display it in a <code>div</code>?</p>
  
  <p>Thank you for your help!</p>