gpt4 book ai didi

sockets - socket.io-ipad最新的iOS xhr轮询

转载 作者:行者123 更新时间:2023-12-03 12:08:56 24 4
gpt4 key购买 nike

我有一个使用最新的socket.io的应用程序。在使用最新iOS的iPad上,我注意到所选的传输方式为xhr-polling。我给人的印象是,websocket在移动浏览器中完全是supported

出于好奇,我想知道为什么在该平台上支持websocket时选择了xhr-polling?

最佳答案

来自here的答案。

Socket.IO never assumes that WebSocket will just work, because in practice there’s a good chance that it won’t. Instead, it establishes a connection with XHR or JSONP right away, and then attempts to upgrade the connection to WebSocket. Compared to the fallback method which relies on timeouts, this means that none of your users will have a degraded experience.



同样,从Offical Socket.io GitHub页面上的README中:

Socket.IO is not a WebSocket implementation. Although Socket.IO indeed uses WebSocket as a transport when possible, it adds some metadata to each packet: the packet type, the namespace and the ack id when a message acknowledgement is needed.

关于sockets - socket.io-ipad最新的iOS xhr轮询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46545784/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com