0

I have been able to successfully run this a few months ago but I am suddenly having problems. It is for a whiteboard app that can also be seen here. The problem I am having is that when I run the command "node server.js" in the node.js command prompt I don't get anything, not even an error. I have tried other tests like Hello World and it has worked fine. My server.js file is listening on port:4000. I think this might be the issue. Here is the code if you think it might be something else.

(function() {
  var io;
  io = require('socket.io').listen(4000);
  io.sockets.on('connection', function(socket) {
    socket.on('drawClick', function(data) {
      socket.broadcast.emit('draw', {
        x: data.x,
        y: data.y,
        type: data.type
      });
    });
  });
}).call(this);

2 Answers 2

1

And to do better filtering, you can use the following :

DEBUG=* // all
DEBUG=socket.io:* // all in socket.io module
DEBUG=socket.io:server // only server debugger
Sign up to request clarification or add additional context in comments.

Comments

0

It's not an issue. It's just a feature of Socket.IO 1.0, which was released a few weeks ago.

Form the official documentation:

Before 1.0, the Socket.IO server would default to logging everything out to the console. This turned out to be annoyingly verbose for many users (although extremely useful for others), so now we default to being completely silent by default.

and

The best way to see what information is available is to use the *:
DEBUG=* node yourfile.js

or in the browser:
localStorage.debug='*';

4 Comments

Thanks, I was just wondering what I would need to do to get the file to act the same. I tried to install the socket.io debug but I am getting repository fail. The command you have shown is that for Node.js command prompt? It's not working for me.
Since resolved the issue and just reverted back to an earlier version.
Are you running node on Windows machine? If so, the above code code will not work. In this case you should set DEBUG system veriable. And I would strongly recommend using Socket.IO 1.0 because it is a lot more reliable then 0.9
Yeah running on Windows 8.0. Server seems to be running ok from the server.js file above. I have entered localhost:4000 into my browser and "welcome to socket.io" is displayed. Packets are now being broadcast from the node command prompt display. Thanks again, much appreciated.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.