I finally got socket.io to work properly, but I have encountered a strange problem.
I am not sure if this is the best way, but I am using:
io.sockets.cli
Why use an (implicit global) variable when you could always filter the array, that is returned by calling the clients() method.
function filterNullValues (i) { return (i!=null); } io.sockets.clients().filter(filterNullValues).length;