Here is an excerpt of the code I am using to make a connection to my chat room...
io.on('connection', function(socket) {
var col = db.collection('messages');
sendStatus = function(s){
socket.emit('status', s);
};
//emit all messages
col.find().limit(100).sort({_id:1}).toArray(function(err, res){
if(err) throw err;
socket.emit('output', res);
});
socket.on('input', function(data) {
...
... etc
What code can I implement to check how many users or participants are connected to my chat room.
I heard of a method clients()
but I'm not sure if that's what I need to use or how to use it.