[OK] refactor the usage of websocket