add socket.io on chat conversation and more refactoring