add listener function in socket.js