chat.js client side socket.io handling