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
Tested using Socket.IO v2.3.0 using namespace, I found 4 locations having the clientCounts property (it's probably the same Server
object each time):
const socketio = require('socket.io');
const io = socketio(http_server);
const io_namespace = io.of('/foobar');
io_namespace.on('connection', function(socket)
{
console.log(socket.conn.server.clientsCount);
console.log(socket.server.engine.clientsCount);
console.log(io.engine.clientsCount);
console.log(io_namespace.server.engine.clientsCount);
});