From dbaf10f84b848ee4d649c5b01228eaf8d0178636 Mon Sep 17 00:00:00 2001 From: birdguo Date: Thu, 28 Dec 2023 09:47:21 +0800 Subject: [PATCH] fix(vue-next): remove unnecessary websocket binding judge --- .../hippy-vue-next/src/runtime/websocket/websocket.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/driver/js/packages/hippy-vue-next/src/runtime/websocket/websocket.ts b/driver/js/packages/hippy-vue-next/src/runtime/websocket/websocket.ts index 53bb5906397..8e594b85408 100644 --- a/driver/js/packages/hippy-vue-next/src/runtime/websocket/websocket.ts +++ b/driver/js/packages/hippy-vue-next/src/runtime/websocket/websocket.ts @@ -52,9 +52,6 @@ const WEB_SOCKET_MODULE_NAME = 'websocket'; // native event name for websocket const WEB_SOCKET_NATIVE_EVENT = 'hippyWebsocketEvents'; -// whether the websocket event listener has been bound -let isBindWebsocketEvent = false; - /** * determine whether it is a legitimate websocket event * @@ -116,11 +113,8 @@ class WebSocket { ...extrasHeaders, }; - if (!isBindWebsocketEvent) { - // The bus is global, if it is multi-instance, there may be problems, to be verified fixme - isBindWebsocketEvent = true; - EventBus.$on(WEB_SOCKET_NATIVE_EVENT, this.onWebSocketEvent); - } + // add websocket event listener to event bus + EventBus.$on(WEB_SOCKET_NATIVE_EVENT, this.onWebSocketEvent); if (!url) { throw new TypeError('Invalid WebSocket url');