socket.io, users in specified socket

I have a little problem with socket.io. I want to update users in specified room. I followed this tutorial and added a "userlist"( http://psitsmike.com/2011/10/node-js-and-socket-io-multiroom-chat-tutorial/ ) when you change room your nickname should disappear from the list and update user/users in the new one

Is it possible by doing something like this?

usernames = {};
var clients = io.sockets.usernames(socket.room);

Then call:

io.sockets.emit('updateusers', clients);

The idea is that rooms have own list of sockets when you enter or leave it it manages own list. So what you want to do, is when user leaves the room - broadcast message to that room:

socket.broadcast.to('room1').emit('userRemove', 'data');

Sockets from that room should process this message on receive, in order to remove actual record from the list (it can be html list if this is web applciation), as on server it is not in the room anymore.

This is called synchronization.