nodejs broadcast in a room console logs

When I broadcast an event in the room along with some data, it is showing that event n times in console. where n = number of players in the room.

If 10 players are in the room then for any broadcast in that room, I will get 10 messages of that event with data on console.

My question is = Whatever I mentioned above is correct or not ? I am getting multiple logs on console that are equal to count of players in the room, hence need to confirm this.

(assuming that your question is "how do I prevent all those messages from being logged")

The default log level for socket.io is 3 (debug).

You can use io.set() to change it to a less verbose level:

  var io = require('socket.io').listen(...);

  io.set('log level', 1);

According to the configuration page of socket.io, these are the possible log levels:

  • 0 – error
  • 1 – warn
  • 2 – info
  • 3 – debug (the default)