websocket 消息可以乱序到达吗? [英] Can websocket messages arrive out-of-order?
问题描述
如果我们通过同一个 html5 websocket 发送两条消息,彼此相隔一毫秒,
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?
推荐答案
简短回答:否.
长答案:
WebSocket 在 TCP 上运行,因此 @EJP 的答案适用于该级别.WebSocket 可以被中介(如 WS 代理)拦截":它们被允许重新排序 WebSocket 控制帧(即 WS pings/pongs),但在没有 WebSocket 扩展时不能重新排序消息帧.如果存在原则上允许重新排序的新扩展,那么中介只有在了解扩展和适用的重新排序规则的情况下才能这样做.
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屋!