NODEJS/socket.io emit not fired

This should be simple, but for some reason my socket.emit will not execute on button press. I know the sumbit button event listener is working. What am I missing?

index.js

io.on('connection', function(socket){  
  io.on('pw', function(data){
    console.log(data)
  });
});

index.html

var submit = document.querySelector('input[type=submit]')
  submit.addEventListener('click',function(){
     socket.emit('pw', 'pw', function(){
       console.log('clicked')
     })
    },false)

You should use socket.on() other than io.on()

io.on('connection', function(socket){  
       socket.on('pw', function(data){
          console.log(data)
       });
   });