Message ordering in socket.io

2019-06-20 01:49发布

Does socket.io guarantee that on() callbacks will be called in the same order that the messages were emitted?

1条回答
Viruses.
2楼-- · 2019-06-20 02:46

Node.js is a single event loop so yes.

But you have another problem, think about the latency between you and your clients, if two clients sent their messages, the first message that came to the server will be handled first, so if the first client emitted his message but he had a higher latency to the server from the second client (which sent his message after the first client), then it's probably be the second client message that will be handled first

查看更多
登录 后发表回答