I am developing an app using Node JS, Socket.io, and Async module by Caolan.
I want to ask something about emitting to lots of clients, and if it block the event loop.
For the use in my app, I need to stack sockets (connected clients informations), and I manage to who I need to emit to.
So once I know who I need to emit to, I loop through the clients using Async.each to emit the datas to clients.
Example:
async.each(clientsIds,
function(item,cb)
{
clients[item].emit('sendData', datas);
cb();
},
function(err)
{
}
);
So my question is: if I have 1000000 clients connected, will it block the Event Loop till it finished to emit to all clients when I send datas?
When I am alone connected, and try to emit 1000000 times to myself, it blocks the Event Loop till the function finished running. Is it because I am sending it 1000000 to the same clients, or the result would be the same if it was 1000000 different connected clients?
Thanks in advance if anyone can help me! I can't do test with mass of connected clients to confirm it myself or not.
(And sorry if it is a noob question, I am not a pro)