@realsee/live 0.5.0-alpha.3 → 0.5.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1277,6 +1277,7 @@ class RobustWebSocket extends Subscribe {
1277
1277
  if (!newUrl)
1278
1278
  return;
1279
1279
  this._pendingReconnect = undefined;
1280
+ this._removeWebSocketEvent();
1280
1281
  this._realWebSocket = new WebSocket(newUrl, this._protocols || undefined);
1281
1282
  this._attempts = this._attempts + 1;
1282
1283
  this.emit('connecting', new CustomEvent('connecting', {
@@ -1298,6 +1299,16 @@ class RobustWebSocket extends Subscribe {
1298
1299
  this._attachConnectivityEvents();
1299
1300
  }
1300
1301
  };
1302
+ /**
1303
+ * 断开ws事件
1304
+ */
1305
+ this._removeWebSocketEvent = () => {
1306
+ var _a, _b, _c, _d;
1307
+ (_a = this._realWebSocket) === null || _a === void 0 ? void 0 : _a.removeEventListener('open', this._webSocketOpenHandler);
1308
+ (_b = this._realWebSocket) === null || _b === void 0 ? void 0 : _b.removeEventListener('close', this._webSocketCloseHandler);
1309
+ (_c = this._realWebSocket) === null || _c === void 0 ? void 0 : _c.removeEventListener('error', this._webSocketErrorHandler);
1310
+ (_d = this._realWebSocket) === null || _d === void 0 ? void 0 : _d.removeEventListener('message', this._webSocketMessageHandler);
1311
+ };
1301
1312
  /**
1302
1313
  * 分发ws事件
1303
1314
  */