Uncaught TypeError: Cannot call method 'onClose' of null

限于喜欢 提交于 2019-11-27 18:35:53

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/15295672/uncaught-typeerror-cannot-call-method-onclose-of-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!