listener to handle requests using socket.io