Is there some kind of ordering mechanism in Socket.io that garanties that events are received in order by clients. Exemple : if Server emits event Evt1 to client A, Server broadcasts Evt2 to all clients. thud client A receives Evt1 then Evt2 and only in that order. I am a bit lazy reading the code and can't find my answer on the net. My guess is NO, and if it's the case how would you implement it or is there existing solutions?
相关问题
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- google-drive can't get push notifications
- How to reimport module with ES6 import
- Why is `node.js` dying when called from inside pyt
- How to verify laravel passport api token in node /
相关文章
- node连接远程oracle报错
- How can make folder with Firebase Cloud Functions
- @angular-cli install fails with deprecated request
- node.js modify file data stream?
- How to resolve hostname to an ip address in node j
- Transactionally writing files in Node.js
- Log to node console or debug during webpack build
- Get file created date in node
Since previous answers could potentially be misleading, I think it's important to clarify one thing:
When using Socket.io with WebSockets, packet order is guaranteed to be maintained.
This is an old post, but it's worth noting that Socket.io over WebSockets actually does guarantee event ordering is maintained. This is because TCP itself, which is the underlying technology for WebSockets & HTTP guarantees packet ordering to be maintained. However Socket.io also supports several other protocols that do not guarantee order.
There have been several posted questions about this issue, supporting this fact:
No, you have to do that at the application level if you need to do that. The internet doesn't guarantee that two different packets will take the same route, so timing can vary. Maybe add a timestamp to each message so you can sort by that timestamp to keep things in order.