Javascript Chat application with websocket