Skip to content

Commit

Permalink
feat(vue-next): fix websocket event not bind
Browse files Browse the repository at this point in the history
  • Loading branch information
zealotchen0 committed Nov 6, 2024
1 parent 007b702 commit d6aa6b3
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -116,11 +113,7 @@ 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);
}
EventBus.$on(WEB_SOCKET_NATIVE_EVENT, this.onWebSocketEvent);

if (!url) {
throw new TypeError('Invalid WebSocket url');
Expand Down

0 comments on commit d6aa6b3

Please sign in to comment.