@realsee/live 0.6.6 → 0.6.8-dev.1
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.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +7 -10
- package/dist/index.es.js.map +1 -1
- package/package.json +6 -1
package/dist/index.es.js
CHANGED
|
@@ -633,7 +633,7 @@ class mr extends ue {
|
|
|
633
633
|
timeout: 1e4,
|
|
634
634
|
shouldReconnect: (e, i) => {
|
|
635
635
|
if (!(e.code === 1008 || e.code === 1011))
|
|
636
|
-
return [
|
|
636
|
+
return [3e3, 6e3, 1e4][i.attempts % 3];
|
|
637
637
|
},
|
|
638
638
|
should1000Reconnect: !1,
|
|
639
639
|
ignoreConnectivityEvents: !1,
|
|
@@ -737,7 +737,7 @@ class mr extends ue {
|
|
|
737
737
|
const e = typeof this._url == "string" ? this._url : (n = this._url) == null ? void 0 : n.call(this, this);
|
|
738
738
|
if (!e)
|
|
739
739
|
return;
|
|
740
|
-
this.
|
|
740
|
+
this._clearPendingReconnectIfNeeded(), this._removeWebSocketEvent(), this._realWebSocket = new WebSocket(e, this._protocols || void 0), this._attempts = this._attempts + 1, this.emit(
|
|
741
741
|
"connecting",
|
|
742
742
|
new CustomEvent("connecting", {
|
|
743
743
|
detail: { attempts: this._attempts, reconnects: this._reconnects }
|
|
@@ -746,13 +746,13 @@ class mr extends ue {
|
|
|
746
746
|
const i = () => {
|
|
747
747
|
this._connectTimeout = void 0, this._detachConnectivityEvents(), this.emit(
|
|
748
748
|
"timeout",
|
|
749
|
-
new CustomEvent("
|
|
749
|
+
new CustomEvent("timeout", {
|
|
750
750
|
detail: {
|
|
751
751
|
attempts: this._attempts,
|
|
752
752
|
reconnects: this._reconnects
|
|
753
753
|
}
|
|
754
754
|
})
|
|
755
|
-
);
|
|
755
|
+
), this.open(this._url);
|
|
756
756
|
};
|
|
757
757
|
this._connectTimeout = setTimeout(i, (c = this._options) == null ? void 0 : c.timeout), this._dispatchWebSocketEvent(), (u = this._options) != null && u.ignoreConnectivityEvents || this._attachConnectivityEvents();
|
|
758
758
|
});
|
|
@@ -775,7 +775,7 @@ class mr extends ue {
|
|
|
775
775
|
* @returns
|
|
776
776
|
*/
|
|
777
777
|
o(this, "_webSocketOpenHandler", (e) => {
|
|
778
|
-
this._connectTimeout && (clearTimeout(this._connectTimeout), this._connectTimeout = void 0);
|
|
778
|
+
this._clearPendingReconnectIfNeeded(), this._connectTimeout && (clearTimeout(this._connectTimeout), this._connectTimeout = void 0);
|
|
779
779
|
const i = ++this._reconnects, n = this._attempts;
|
|
780
780
|
return this._attempts = 0, this._reconnectWhenOnlineAgain = !1, this._startHealthCheck(), this.emit("open", Object.assign(e, { detail: { reconnects: i, attempts: n } }));
|
|
781
781
|
});
|
|
@@ -841,8 +841,7 @@ class vr extends ue {
|
|
|
841
841
|
* ws代理器
|
|
842
842
|
*/
|
|
843
843
|
o(this, "_ws", new mr({
|
|
844
|
-
url: ""
|
|
845
|
-
robustOptions: { timeout: 18e4 }
|
|
844
|
+
url: ""
|
|
846
845
|
}));
|
|
847
846
|
/**
|
|
848
847
|
* 带看连接状态
|
|
@@ -865,9 +864,7 @@ class vr extends ue {
|
|
|
865
864
|
* @param event
|
|
866
865
|
*/
|
|
867
866
|
o(this, "_handleCloseEvent", (e) => {
|
|
868
|
-
O.info(
|
|
869
|
-
`live room closed bacause of ${e.code}-${e.reason || nr(e.code)}`
|
|
870
|
-
), this.state = x.CLOSED;
|
|
867
|
+
O.info(`live room closed bacause of ${e.code}-${e.reason || nr(e.code)}`), this.state = x.CLOSED;
|
|
871
868
|
});
|
|
872
869
|
/**
|
|
873
870
|
* 处理房间正在关闭事件(这个时候可能是断网了)
|