[node.js] Socket.IO - how do I get a list of connected sockets/clients?

After socket.io 1.0 we cannot use

io.sockets.clients(); 
or
io.sockets.clients('room'); 

anymore. Instead you can use the following

var clients_in_the_room = io.sockets.adapter.rooms[roomId]; 
for (var clientId in clients_in_the_room ) {
  console.log('client: %s', clientId); //Seeing is believing 
  var client_socket = io.sockets.connected[clientId];//Do whatever you want with this
}