@zyzgroup/core-web 0.1.84 → 0.1.85
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/zyzgroup_core_web.iife.js +1 -1
- package/dist/zyzgroup_core_web.iife.js.map +1 -1
- package/dist/zyzgroup_core_web.js +21 -19
- package/dist/zyzgroup_core_web.js.map +1 -1
- package/dist/zyzgroup_core_web.umd.cjs +1 -1
- package/dist/zyzgroup_core_web.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/types/WebSocketClient.d.ts +3 -3
- package/types/WebSocketClient.d.ts.map +1 -1
|
@@ -21706,7 +21706,7 @@ class me {
|
|
|
21706
21706
|
const { code: e, reason: s, wasClean: r } = t;
|
|
21707
21707
|
oe(
|
|
21708
21708
|
`ws(${this.url}) onclose: code(${e}) reason(${s}) wasClean(${r})`
|
|
21709
|
-
), this.state = me.CLOSED, this.pingTimerID && (clearInterval(this.pingTimerID), this.pingTimerID = void 0), this.onclose?.(t), this.reconnect && this.reconnectAttempts < this.maxReconnectAttempts && (this.
|
|
21709
|
+
), this.state = me.CLOSED, this.socket = void 0, this.pingTimerID && (clearInterval(this.pingTimerID), this.pingTimerID = void 0), this.onclose?.(t), this.reconnect && this.reconnectAttempts < this.maxReconnectAttempts && (this.reconnectTimerID = setTimeout(
|
|
21710
21710
|
this._connect.bind(this),
|
|
21711
21711
|
Fa(this.reconnectAttempts++)
|
|
21712
21712
|
));
|
|
@@ -21715,34 +21715,36 @@ class me {
|
|
|
21715
21715
|
}, this.socket.onmessage = (t) => {
|
|
21716
21716
|
if (oe(`ws(${this.url}) onmessage: { type: ${t.type}, data: ${t.data} }`), typeof t.data == "string") {
|
|
21717
21717
|
let e;
|
|
21718
|
+
const s = t.data.substring(1);
|
|
21718
21719
|
try {
|
|
21719
|
-
e = JSON.parse(
|
|
21720
|
-
} catch (
|
|
21720
|
+
e = JSON.parse(s);
|
|
21721
|
+
} catch (r) {
|
|
21721
21722
|
e = [
|
|
21722
21723
|
JSON.stringify({
|
|
21723
21724
|
type: "err",
|
|
21724
|
-
|
|
21725
|
-
|
|
21725
|
+
failureCode: "fe-json-parse-error",
|
|
21726
|
+
failureType: r.toString(),
|
|
21727
|
+
message: s
|
|
21726
21728
|
})
|
|
21727
21729
|
];
|
|
21728
21730
|
}
|
|
21729
|
-
e.forEach((
|
|
21730
|
-
const
|
|
21731
|
-
if (
|
|
21732
|
-
const
|
|
21733
|
-
|
|
21731
|
+
e.forEach((r) => {
|
|
21732
|
+
const i = JSON.parse(r);
|
|
21733
|
+
if (i.body && Object.prototype.hasOwnProperty.call(i.body, "requestid")) {
|
|
21734
|
+
const o = this.waitings[i.body.requestid];
|
|
21735
|
+
o ? o.resolve?.(i.body) : _n(
|
|
21734
21736
|
`ws(${this.url}) onmessage: found no associated request, already timed out`
|
|
21735
21737
|
);
|
|
21736
|
-
} else if (this.listeners[
|
|
21737
|
-
const
|
|
21738
|
-
for (let
|
|
21739
|
-
|
|
21740
|
-
failureCode:
|
|
21741
|
-
failureType:
|
|
21742
|
-
message:
|
|
21743
|
-
}) :
|
|
21738
|
+
} else if (this.listeners[i.address]) {
|
|
21739
|
+
const o = this.listeners[i.address];
|
|
21740
|
+
for (let a = 0; a < o.length; a++)
|
|
21741
|
+
i.type === "err" ? o[a]({
|
|
21742
|
+
failureCode: i.failureCode,
|
|
21743
|
+
failureType: i.failureType,
|
|
21744
|
+
message: i.message
|
|
21745
|
+
}) : o[a](null, i.body);
|
|
21744
21746
|
} else
|
|
21745
|
-
this.onunhandled(
|
|
21747
|
+
this.onunhandled(i);
|
|
21746
21748
|
});
|
|
21747
21749
|
} else
|
|
21748
21750
|
t.data instanceof ArrayBuffer ? _n(`ws(${this.url}) onmessage: unhandle ArrayBuffer`) : t.data instanceof Blob && _n(`ws(${this.url}) onmessage: unhandle Blob`);
|