未捕获的TypeError:无法调用null的方法'onClose' [英] Uncaught TypeError: Cannot call method 'onClose' of null

查看:351
本文介绍了未捕获的TypeError:无法调用null的方法'onClose'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在node.js聊天应用程序上工作,我在IIS上的IIS上托管了node.js.
我打算在Asp.net mvc中包含node.js,如 Jon Galloway



我的安装细节:

iisnode.js - iisnode-full-iis7-v0.2.3-x86

node.js - node-v0。 8.19-x86

express.js版本 - 3.1.0

socket.io版本 - 0.9.13
Windows 7上的
带有IIS 8.0 express的32位系统



我在IIS上成功托管了node.js,并运行示例



<但是,当我开始coading socket.io时,我卡住了..



当我开始连接客户端浏览器到服务器时,我在客户端浏览器时收到错误说

未捕获的TypeError:无法调用null的socket.io.js方法'onClose':1771



在我的服务器应用中使用iam socket.io配置为

  io.configure(function(){
io.set('transports',[
'xhr-轮询'
,'jsonp-polling'
]);
io.set(投票期限,10);
if(process.env.IISNODE_VERSION){
io.set('resource','node / socket.io');
}
});

此问题是否与使用的版本iam(express,和socket.io node.js)有关我的指点,对这个问题的任何想法请帮助我。



谢谢。

解决方案

我认为这是因为你没有在客户端socket.io配置中设置资源路径。

  socket = io.connect('http://myurl/node/socket.io',{resource:'node / socket.io'})


Iam working on node.js chat application, i've hosted the node.js on IIS in windows. my intention is to include the node.js in Asp.net mvc as explained by Jon Galloway for performing chatting( text, audio ,video ) in asp.net web application.

my Installation details:
iisnode.js - iisnode-full-iis7-v0.2.3-x86
node.js - node-v0.8.19-x86
express.js version - 3.1.0
socket.io version - 0.9.13
on windows 7 32 bit system with IIS 8.0 express

I've successfully hosted the node.js on IIS, and run the samples

But when i start coading socket.io i got stuck..

when i start connecting with client browser to server, i got an error at client browser saying
Uncaught TypeError: Cannot call method 'onClose' of null socket.io.js:1771

In my server app iam using socket.io configuration as

io.configure(function () {
    io.set('transports', [    
           'xhr-polling'
         , 'jsonp-polling'
      ]);
        io.set("polling duration", 10); 
        if (process.env.IISNODE_VERSION) {
            io.set('resource', 'node/socket.io'); 
        }
    });

Is this issue related to versions iam using (express, and socket.io node.js) Or in my coading, any idea about the issue please help me.

thank you.

解决方案

I think it's because you didn't set the resource path in the client socket.io configuration.

socket = io.connect('http://myurl/node/socket.io', { resource : 'node/socket.io' })

这篇关于未捕获的TypeError:无法调用null的方法'onClose'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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