@zyzgroup/core-web 0.1.75 → 0.1.76

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.
@@ -21701,7 +21701,7 @@ class me {
21701
21701
  ), this.socket.onopen = () => {
21702
21702
  oe(`ws(${this.url}) onopen`), this.state = me.OPEN, this.ping(), this.pingTimerID = setInterval(this.ping.bind(this), this.pingInterval), this.reconnectTimerID && (clearTimeout(this.reconnectTimerID), this.reconnectTimerID = void 0);
21703
21703
  const t = this.messageQueue.slice();
21704
- this.messageQueue = [], t.forEach(this._send), this.onopen?.();
21704
+ this.messageQueue = [], t.forEach(this._send.bind(this)), this.onopen?.();
21705
21705
  }, this.socket.onclose = (t) => {
21706
21706
  const { code: e, reason: s, wasClean: r } = t;
21707
21707
  oe(
@@ -21709,7 +21709,7 @@ class me {
21709
21709
  ), this.state = me.CLOSED, this.pingTimerID && (clearInterval(this.pingTimerID), this.pingTimerID = void 0), this.onclose?.(t), this.reconnect && this.reconnectAttempts < this.maxReconnectAttempts && (this.socket = void 0, this.reconnectTimerID = setTimeout(
21710
21710
  this._connect.bind(this),
21711
21711
  Fa(this.reconnectAttempts++)
21712
- ), console.log(this.reconnectAttempts));
21712
+ ));
21713
21713
  }, this.socket.onerror = (t) => {
21714
21714
  oe(`ws(${this.url}) onerror: ${t.type} ${t}`), this.onerror?.(t);
21715
21715
  }, this.socket.onmessage = (t) => {
@@ -21755,7 +21755,7 @@ class me {
21755
21755
  }
21756
21756
  // 可能需要根据协议变更传输格式
21757
21757
  _send(t) {
21758
- this.socket && this.socket.readyState === me.OPEN ? this.socket.send(JSON.stringify(t)) : (this.messageQueue.push(t), this._connect());
21758
+ this.socket?.readyState === me.OPEN ? this.socket.send(JSON.stringify(t)) : (this.messageQueue.push(t), this._connect());
21759
21759
  }
21760
21760
  ping() {
21761
21761
  this._send({ type: "ping" });