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
I'm using socket.io 0.9.10 and the following code to determine the number of sockets:
var socketIO = require('socket.io').listen( .....
var numberOfSockets = Object.keys(socketIO.connected).length;
Not sure how accurate this number reacts to the various edge-cases, but 'til now it seems accurate: every browser connecting increases the number, every browser closed decreases it.