Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vue-next): remove unnecessary websocket binding judge #3695

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,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');
Expand Down
Loading