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 have found the way to figure it out in version 1.3.7. There are three methods as follows:
io.engine.clientsCount
io.sockets.sockets.length
Object.keys(io.sockets.connected).length
Hope these can help someone with the same issue.:)