We currently need to send data to multiple connected client, each of them have a unique channel name, for instance CHANNEL1, CHANNEL2, CHANNEL3 Etc. When trying to cycle through all the channels for example, 30.000 channels. It sends the first one, then it waits till the loop finishes before sending the rest.
io.on('connection', function (socket){
socket.on('chat message', function (msg){
for (i = 0; i < 30000; i++) {
io.emit('CHANNEL' + i, msg);
}
});
});
Is there a way it sends the emits asynchronously, while it loops 1 by 1?