[解决]socket.io 1.3X,用socket.io-client链接服务器得到的transport类型都是polling?
发布于 2天前 作者 lonso 153 次浏览 最后一次编辑是 1天前 来自 问答

socket.io 1.3X,用socket.io-client链接服务器得到的transport类型都是polling? 为什么不是websocket,有什么地方需要特别设置么,原来0.9X上去该是什么就是什么,现在上去全是polling-xhr

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.

#1995

2 回复

这样连接起来会慢

@yakczh 所以需要手动设置客户端用websocket

回到顶部