Here is my improved version of the chat application. Playing with the code made me learn a lot about the server side js, browser side js and socket.io. Still have a lot way to go but at least I think I have the basics for now. I changed server side and browser side js codes to make the improvements.
The chat page is hosted here: http://220.127.116.11:8080/index.html