当服务器接收到一个emit(即由客户端生成的)时,回调函数是否在处理下一个emit之前完成?
例如:
socket.on('disconnect', function() {
log('disconnect START - ' + socket.id);
...
...
Do some stuff
...
...
log('disconnect END - ' + socket.id);
});
我在日志中似乎得到了这个输出:
disconnect START - z0w0W4scKZ8o6c4nAAAm
disconnect END - z0w0W4scKZ8o6c4nAAAm
disconnect START - LLnSgRBV9NZ35mjrAAAk
disconnect START - djl3hyNvIwAhSEDbAAAn
disconnect END - LLnSgRBV9NZ35mjrAAAk
disconnect END - djl3hyNvIwAhSEDbAAAn
正如您所看到的,一个 START 在到达 END 之前会中断另一个...