websocket消息可以无序到达吗? [英] Can websocket messages arrive out-of-order?

查看:1729
本文介绍了websocket消息可以无序到达吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们通过相同的html5 websocket发送两条消息,并且距离彼此相距毫秒,那么

理论上消息的到达顺序可能与他们被发送了?

解决方案

简短回答:不。

回答:



WebSocket在TCP上运行,所以在这个级别@EJP的答案适用。 WebSocket可以被中介(如WS代理)拦截:可以对WebSocket控制帧(即WS ping / pong)进行重新排序,但是当没有WebSocket扩展时,不允许消息帧。如果有一个原则上允许重新排序的neogiated扩展,那么中介只有在理解扩展和适用的重新排序规则时才可以这样做。

If we send two messages over the same html5 websocket a split millisecond apart from each other,

Is it theoretically possible for the messages to arrive in a different order than they were sent?

解决方案

Short answer: No.

Long answer:

WebSocket runs over TCP, so on that level @EJP 's answer applies. WebSocket can be "intercepted" by intermediaries (like WS proxies): those are allowed to reorder WebSocket control frames (i.e. WS pings/pongs), but not message frames when no WebSocket extension is in place. If there is a neogiated extension in place that in principle allows reordering, then an intermediary may only do so if it understands the extension and the reordering rules that apply.

这篇关于websocket消息可以无序到达吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆