未捕获的类型错误:无法调用 null 的方法“onClose" [英] Uncaught TypeError: Cannot call method 'onClose' of null

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

问题描述

我正在研究 node.js 聊天应用程序,我已经在 Windows 的 IIS 上托管了 node.js.我的目的是将 node.js 包含在 Asp.net mvc 中,如 Jon Galloway 用于在 asp.net 网络应用程序中执行聊天(文本、音频、视频).

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.

我的安装细节:
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
在带有 IIS 8.0 express 的 Windows 7 32 位系统上

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

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

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

但是当我开始编写 socket.io 时,我卡住了..

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

当我开始用客户端浏览器连接到服务器时,我在客户端浏览器上遇到一个错误,说
未捕获的类型错误:无法调用 null socket.io.js:1771

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

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

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'); 
        }
    });

这个问题是否与 iam 使用的版本有关(express 和 socket.io node.js)或者在我的代码中,任何关于这个问题的想法请帮助我.

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.

谢谢.

推荐答案

我觉得是你没有在客户端socket.io配置中设置资源路径.

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' })

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

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