I am currently working on a game, and I am sending the info of all 100 players to each other.
The way I am currently doing this is by doing
for (ws in wsArr) {
ws.send(data, true); // data is around 2000 bytes big
}
I benchmarked this loop and found that it takes around 12ms.
But when I switched to this
app.publish('global', data, true) // same size of data
It only took around 3ms
So what's the catch here?
I am currently working on a game, and I am sending the info of all 100 players to each other.
The way I am currently doing this is by doing
I benchmarked this loop and found that it takes around 12ms.
But when I switched to this
It only took around 3ms
So what's the catch here?