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

标签 sockets socket.io

我有一个使用最新的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/

相关文章:

java - 连续读取套接字的所有输入

javascript - 套接字 - 客户端站点上不显示任何数据

c++ - 使用QTcpSocket实现连续快速使用

Python socket 客户端 Post 参数

javascript - 断开连接时更新客户端中的用户列表

javascript - 在 Socket IO 和 Node JS 中轮询 MySQL DB

amazon-ec2 - 如何在 Amazon EC2 实例上允许 Socket IO 请求?

node.js - Socket.io + express : Different events/functions for different routes

node.js - 未捕获的类型错误 : Cannot read property 'copy' of undefined p5. js/node.js/socket.io

node.js - Socket.io 和 Redis 发布/订阅