EDITABLE CODE:

LiveDemo: HTML5 WebSocket API Demo