Amin Amin - 1 month ago 7
Node.js Question

socket.io does not run on Mac as expected

I am using this tutorial series to make a chat messenger using socket.io, nodeJS and Mongodb on Mac OSX. according to the tutorial when we run server.js socket.io must start working but when I run the command:

node server.js


the terminal shows nothing:
Terminal

server.js:

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

Answer

The default configuration of socket.io does not show anything on the debug console when you start it up. It used to be (in older versions of socket.io) that the default configuration would show some startup messages, but that is no longer the case (I'm guessing that's what your tutorial shows).

So, I'd suggest you verify that the socket.io server is actually running by either connecting to it or by looking at the open sockets for your node.js process to see it listening.