refactored index js code
refactored js code to display the chat message instantly
Merge pull request #9 from Ajeey/refactor

Refactor