What is the “efficient way” to check if any client number is connected or exists?
socket.on('pm', function(data) { data.from = socket.decoded_token._id; var to = data.to; if (_.isUndefined(io.sockets.adapter.rooms[to])) { debug("user [%s] is not connected", to); } else { socket.to(to).emit('pm', message); } });
Is this an efficient way to do this with multiple instances of socket.io and redis adapter? I would like something like this one could use:
socket.on('pm', function(data) { data.from = socket.decoded_token._id; var to = data.to; socket.to(to).emit('pm', message, function(err){
source share