NodeJS& Socket.io:Chrome未使用WebSockets加载 [英] NodeJS & Socket.io: Chrome not loading with WebSockets

查看:102
本文介绍了NodeJS& Socket.io:Chrome未使用WebSockets加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Chrome正在加载长轮询,并且加载指示灯不会停止。



为什么Chrome不使用WebSockets,并且如何防止加载指示器在使用长轮询时旋转?



我正在使用最新的socket.io和nodejs v2.5



-



第一次连接时,它使用Websocket,但立即断开连接并重新连接到xhr-polling。 我有一个类似的问题,我发现有一个socketio cookie将传输方法覆盖为xhr-polling。我不知道cookie是如何到达那里的,但是删除它却做到了这一点。



以下是对查找cookie的行的引用。
https://github.com/LearnBoost /Socket.IO/blob/master/socket.io.js#L1023


Chrome is loading with long polling, and the loading indicator doesn't stop.

Why is Chrome not using WebSockets, and how can I prevent the loading indicator from spinning when it does use long polling?

I'm using the latest socket.io and nodejs v2.5

--

The first time I connect, it uses Websocket, but disconnects right away and reconnects with xhr-polling.

解决方案

I had a similar problem and I found that there was a socketio cookie overriding the transport method to "xhr-polling". I don't know how the cookie got there, but deleting it did the trick.

Here's a reference to the line that looks for the cookie. https://github.com/LearnBoost/Socket.IO/blob/master/socket.io.js#L1023

这篇关于NodeJS& Socket.io:Chrome未使用WebSockets加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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