@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.
@@ -1287,6 +1287,7 @@ class RobustWebSocket extends Subscribe {
1287
1287
  if (!newUrl)
1288
1288
  return;
1289
1289
  this._pendingReconnect = undefined;
1290
+ this._removeWebSocketEvent();
1290
1291
  this._realWebSocket = new WebSocket(newUrl, this._protocols || undefined);
1291
1292
  this._attempts = this._attempts + 1;
1292
1293
  this.emit('connecting', new CustomEvent('connecting', {
@@ -1308,6 +1309,16 @@ class RobustWebSocket extends Subscribe {
1308
1309
  this._attachConnectivityEvents();
1309
1310
  }
1310
1311
  };
1312
+ /**
1313
+ * 断开ws事件
1314
+ */
1315
+ this._removeWebSocketEvent = () => {
1316
+ var _a, _b, _c, _d;
1317
+ (_a = this._realWebSocket) === null || _a === void 0 ? void 0 : _a.removeEventListener('open', this._webSocketOpenHandler);
1318
+ (_b = this._realWebSocket) === null || _b === void 0 ? void 0 : _b.removeEventListener('close', this._webSocketCloseHandler);
1319
+ (_c = this._realWebSocket) === null || _c === void 0 ? void 0 : _c.removeEventListener('error', this._webSocketErrorHandler);
1320
+ (_d = this._realWebSocket) === null || _d === void 0 ? void 0 : _d.removeEventListener('message', this._webSocketMessageHandler);
1321
+ };
1311
1322
  /**
1312
1323
  * 分发ws事件
1313
1324
  */