Node.js connection error, missing property?

EDIT

Decision:

Visit your IP address in the browser after you "node server.js" to start the connection. I don't know why this works, but this is for me.

How did it happen

Mkay .. after I redid the slice (hosted on slicehost, if that matters) and reinstalling the node and websocket-server I still had the same problem. I checked if the regular request (entering the IP address in the browser) that it made worked. It also seemed to trigger socket connections, so now I can connect to them.


I am trying to connect to a socket server using node.js and the websocket-server module.

The server side is as follows:

var server = ws.createServer(); server.listen(80); server.addListener("request", function(req, res) { res.writeHead(200, { "Content-Type": "text/plain" }); res.write("Hey! This is totally not the site you planned to visit."); res.end(); }); server.addListener("connection", function(conn) { conn.addListener("readyStateChange", function(readyState) { }); conn.addListener("open", function() { }); conn.addListener("close", function() { }); conn.addListener("message", function(message) { server.broadcast(conn._id + ": "+message); }); }); 

Standard procedure. When trying to connect from a client like this ...

  if ( window["WebSocket"] ) { connection = new WebSocket("ws://[my IP]:80/"); connection.onopen = function( event ) { console.log("connection open"); } connection.onclose = function( event ) { console.log("connection closed"); } connection.onerror= function( event ) { console.log("connection error"); } connection.onmessage = function( event ) { console.log(event.data); }; } 

... I get the following error:

_linklist.js: 65

item._idleNext = list._idleNext;

TypeError: Unable to read the '_idleNext' property from undefined in Object.append (_linklist.js: 65: 24) in Object.active (timers.js: 136: 9) on Socket._writeOut (net.js: 461: 10)

 at Socket.write (net.js:378:17) at Object.draft76 ([my dir]/npm/node_modules/websocket-server/lib/ws/connection.js:401:28) at new Connection ([my dir]npm/node_modules/websocket-server/lib/ws/connection.js:165:22) at Server.<anonymous> ([my dir]npm/node_modules/websocket-server/lib/ws/server.js:72:7) at Server.emit (events.js:81:20) at Socket.<anonymous> (http.js:1034:14) at Socket._onReadable (net.js:684:27) 

It worked for a while (which is strange, I think), and then this message started appearing whenever I tried to connect. I have not changed anything in the node.js or websocket-server code. Penny so anyone can tell me why this is happening!

+4
source share
1 answer

Visit your IP address in the browser after you "node server.js" to start the connection. I don't know why this works, but this is for me.

Also, make sure you have a stable version of Node. When the problem arose, I was unstable.

0
source

All Articles