gpt4 book ai didi

javascript - Socket.io TypeError : this. 传输未定义

转载 作者:太空宇宙 更新时间:2023-11-04 02:42:40 25 4
gpt4 key购买 nike

我在我的网站上添加了用户端错误日志记录。有时它会记录来自 socket.io 代码的此类错误:

TypeError: this.transport is undefined

只有在 Windows 上使用 Firefox 15 版本的用户才会出现此错误。

在服务器端,我像这样定义我的传输:

this.io.configure(function(){
self.io.set('transports', ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling']);
self.io.set('log level', 0);
});

Socket.io版本是0.9.10。

您能告诉我这个错误的原因是什么吗?

任何帮助表示赞赏。

最佳答案

configure方法用于为特定环境设置配置。您没有指定环境,因此您可以删除 configure 回调函数并简单地执行以下操作:

this.io.set('transports', ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling']);
this.io.set('log level', 0);

关于javascript - Socket.io TypeError : this. 传输未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12562997/

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