Modified some part (Step 4, 5 and 6) of WebSocket Client