Message ordering in socket.io

陌路散爱 提交于 2019-12-23 09:39:30

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/14933868/message-ordering-in-socket-io

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!