I have a socket.io server which listens to sockets:
io.sockets.on('connection', function(socket){
socket.on('myEvent', function(data){
socket.emit('eventReceived', { status: 1 });
});
});
Is this code working in multithread? if two clients will emit the myEvent event, it will work at the same time for both clients? or it will be handled one after the other?
Many thanks!
Nothing in Node.js is multithreaded including any packages available through npm. There is an experimental cluster module available in the core
http://nodejs.org/docs/v0.10.2/api/cluster.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With