@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.
@@ -49501,6 +49501,7 @@
49501
49501
  if (!newUrl)
49502
49502
  return;
49503
49503
  this._pendingReconnect = undefined;
49504
+ this._removeWebSocketEvent();
49504
49505
  this._realWebSocket = new WebSocket(newUrl, this._protocols || undefined);
49505
49506
  this._attempts = this._attempts + 1;
49506
49507
  this.emit('connecting', new CustomEvent('connecting', {
@@ -49522,6 +49523,16 @@
49522
49523
  this._attachConnectivityEvents();
49523
49524
  }
49524
49525
  };
49526
+ /**
49527
+ * 断开ws事件
49528
+ */
49529
+ this._removeWebSocketEvent = () => {
49530
+ var _a, _b, _c, _d;
49531
+ (_a = this._realWebSocket) === null || _a === void 0 ? void 0 : _a.removeEventListener('open', this._webSocketOpenHandler);
49532
+ (_b = this._realWebSocket) === null || _b === void 0 ? void 0 : _b.removeEventListener('close', this._webSocketCloseHandler);
49533
+ (_c = this._realWebSocket) === null || _c === void 0 ? void 0 : _c.removeEventListener('error', this._webSocketErrorHandler);
49534
+ (_d = this._realWebSocket) === null || _d === void 0 ? void 0 : _d.removeEventListener('message', this._webSocketMessageHandler);
49535
+ };
49525
49536
  /**
49526
49537
  * 分发ws事件
49527
49538
  */
@@ -50976,6 +50987,7 @@
50976
50987
  if (!newUrl)
50977
50988
  return;
50978
50989
  this._pendingReconnect = undefined;
50990
+ this._removeWebSocketEvent();
50979
50991
  this._realWebSocket = new WebSocket(newUrl, this._protocols || undefined);
50980
50992
  this._attempts = this._attempts + 1;
50981
50993
  this.emit('connecting', new CustomEvent('connecting', {
@@ -50997,6 +51009,16 @@
50997
51009
  this._attachConnectivityEvents();
50998
51010
  }
50999
51011
  };
51012
+ /**
51013
+ * 断开ws事件
51014
+ */
51015
+ this._removeWebSocketEvent = () => {
51016
+ var _a, _b, _c, _d;
51017
+ (_a = this._realWebSocket) === null || _a === void 0 ? void 0 : _a.removeEventListener('open', this._webSocketOpenHandler);
51018
+ (_b = this._realWebSocket) === null || _b === void 0 ? void 0 : _b.removeEventListener('close', this._webSocketCloseHandler);
51019
+ (_c = this._realWebSocket) === null || _c === void 0 ? void 0 : _c.removeEventListener('error', this._webSocketErrorHandler);
51020
+ (_d = this._realWebSocket) === null || _d === void 0 ? void 0 : _d.removeEventListener('message', this._webSocketMessageHandler);
51021
+ };
51000
51022
  /**
51001
51023
  * 分发ws事件
51002
51024
  */