gpt4 book ai didi

node.js - Socket.IO 在 Google Chrome 43.0.2357.65 上停止工作

转载 作者:搜寻专家 更新时间:2023-10-31 23:47:54 24 4
gpt4 key购买 nike

请帮帮我!

在我的网站上更新到最新版本的 Google Chrome (43.0.2357.65) 后,socket.io 停止工作。

它发送了太多的请求,每次都创建新的套接字连接。

我站Google Developer Tools截图网:http://i.stack.imgur.com/TLXGg.png

但是socket.io网站上的演示例子http://socket.io/demos/chat/工作正常。

socket.io 演示网络截图://i.stack.imgur.com/QWNW2.png

我在客户端使用这段代码:

 $.getScript('http://localhost:1337/socket.io/socket.io.js', function () {
var socket = io.connect('http://localhost:1337/?token=ABCDEF');
});

在其他浏览器中代码工作正常,在更新前的谷歌浏览器中工作正常

Socket.io 版本 1.3.5

在控制台中我有这些调试消息:

engine.io-client:polling-xhr xhr open GET: //it.iksys:1337/socket.io/?token=410235d6a03ead4497fa18037e8da5d73133367d&EIO=3&transport=polling&t=1432302871093-738 +1ms  
socket.io.js?_=1432302864284:3715 engine.io-client:polling-xhr xhr data null +1ms
socket.io.js?_=1432302864284:3715 engine.io-client:polling polling got data ok +4ms
socket.io.js?_=1432302864284:3715 engine.io-client:socket socket receive: type "error", data "parser error" +0ms
socket.io.js?_=1432302864284:3715 engine.io-client:polling polling +1ms
socket.io.js?_=1432302864284:3715 engine.io-client:polling-xhr xhr poll +1ms
socket.io.js?_=1432302864284:3715 engine.io-client:polling-xhr xhr open

最佳答案

我找到了为客户端定义 websocket 传输的解决方案:

Node :

var options = {};
options.transports = ['websocket'];
var socket = io.connect('http://localhost:1337/?token=ABCDEF', options);

角度 4:

 this.socket = io(environment.socketURL, {  upgrade: false, transports: [ 'websocket' ], query: {token: TokenService.token()}});

我想这个版本的谷歌浏览器在 xhr-polling 方面存在一些问题。

关于node.js - Socket.IO 在 Google Chrome 43.0.2357.65 上停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30392980/

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