Q:

socket.on() too many times

so the code goes like this:
io.on("connection", function(socket){
  socket.on("channel1",function(data){})
  socket.on("channel2",function(data){})
  socket.on("channel3",function(data){})
  socket.on("channel4",function(data){})
  socket.on("channel5",function(data){})
})

so i created one socket.io connection, and inside of it there are many "socket"s, I wonder if this is ok because it seems i'm abusing it.. is there any bad consequence of creating so many sockets inside the io.on() ?

A:

There is absolutely nothing wrong with what you're doing, but I think you're kinda misunderstanding what you're code really does, and how socket.io is really working.
Socket.io is a layer above the webSocket api, which allows you to emit and listen to events through the socket, so your server can emit events towards your client, and your client can emit events towards your server. The client actually sends a message commanding your server-side socket object to emit the corresponding event server-side.
So, what you are really doing, is just listening to the events named "Channel1", "Channel2" ... emitted in your server side object called socket. There's definitely nothing wrong with that.
Edit : You are actually creating only one socket object, by the way.

