0

Here is the server.js code :

var mongo = require('mongodb').MongoClient,
    client = require('socket.io').listen(8080).sockets;

Here is the response on cmd when running it using debug:

C:\Users\User Name\Desktop\chat>node debug server.js
< debugger listening on port 5858
connecting... ok
break in C:\Users\User Name\Desktop\chat\server.js:1
  1 var mongo = require('mongodb').MongoClient,
  2     client = require('socket.io').listen(8080).sockets;
  3
debug>

There is no result/response when not using debug.

I am trying the nodejs chat implementation as shown here: https://www.youtube.com/watch?v=GkXQEwHn2nA

Expected response: socket.io started

Let me know if you need any other details.

user3537741
  • 21
  • 1
  • 2
  • Which version of socket.io are you using? – Yousef Jan 26 '15 at 18:06
  • Have you verified that it's not listening by checking with `netstat -nl`? – mscdex Jan 26 '15 at 18:35
  • @Yousef The version is 1.3.2 – user3537741 Jan 27 '15 at 10:05
  • @mscdex That does not return anything. I am on windows. I do think for some reason socket.io is not starting, MongoDB seems to be listening. Just to inform you when i ran the server.js code for the first time, there was a windows prompt regarding I/O and i allowed access to all private networks. I am not sure if the problem is related to that. – user3537741 Jan 27 '15 at 10:36
  • Ok, on Windows the command would be `netstat -an` once your node script is running. – mscdex Jan 27 '15 at 13:12
  • I changed the port to 1500 in server.js . When I ran `netstat -an` I got this from the list `TCP 0.0.0.0:1500 0.0.0.0:0 LISTENING ` I think its listening. – user3537741 Jan 27 '15 at 14:20
  • I believe that video is using socketio v.9 which outputs socket.io started. If you're using v1 try DEBUG=socket.io* node server.js to see debug logs – Yousef Jan 27 '15 at 18:39
  • @Yousef That does not seem to run on windows. – user3537741 Jan 27 '15 at 20:29
  • I rolled back to older socket.io <1 version for the time being, seems to be working now. – user3537741 Jan 27 '15 at 20:57
  • @user3537741 try using set DEBUG=* (http://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-in-windows) – Yousef Jan 27 '15 at 21:56

0 Answers0