@koi-design/callkit 2.0.1 → 2.0.2
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.d.ts +1 -0
- package/dist/index.global.js +30 -10
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +30 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -587,7 +587,7 @@ var Call = class {
|
|
|
587
587
|
// package.json
|
|
588
588
|
var package_default = {
|
|
589
589
|
name: "@koi-design/callkit",
|
|
590
|
-
version: "2.0.
|
|
590
|
+
version: "2.0.2",
|
|
591
591
|
description: "callkit",
|
|
592
592
|
author: "koi",
|
|
593
593
|
license: "ISC",
|
|
@@ -1897,9 +1897,33 @@ var Socket = class {
|
|
|
1897
1897
|
});
|
|
1898
1898
|
return;
|
|
1899
1899
|
}
|
|
1900
|
+
if (this.isReconnecting) {
|
|
1901
|
+
return;
|
|
1902
|
+
}
|
|
1900
1903
|
this.attemptReconnect();
|
|
1901
1904
|
}
|
|
1905
|
+
clearWebSocket() {
|
|
1906
|
+
if (this.ws) {
|
|
1907
|
+
this.ws.onopen = null;
|
|
1908
|
+
this.ws.onclose = null;
|
|
1909
|
+
this.ws.onerror = null;
|
|
1910
|
+
this.ws.onmessage = null;
|
|
1911
|
+
}
|
|
1912
|
+
if (this.ws.readyState === WebSocket.CONNECTING || this.ws.readyState === WebSocket.OPEN) {
|
|
1913
|
+
this.ws.close();
|
|
1914
|
+
this.callKit.logger.info("socket clear", {
|
|
1915
|
+
caller: "Socket.clearWebSocket",
|
|
1916
|
+
type: "INCALL",
|
|
1917
|
+
content: {}
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
this.ws = void 0;
|
|
1921
|
+
this.isConnected = false;
|
|
1922
|
+
}
|
|
1902
1923
|
connect(socketUrl) {
|
|
1924
|
+
if (this.ws) {
|
|
1925
|
+
this.clearWebSocket();
|
|
1926
|
+
}
|
|
1903
1927
|
this.ws = new WebSocket(socketUrl);
|
|
1904
1928
|
this.ws.onopen = (ev) => this.onOpen(ev);
|
|
1905
1929
|
this.ws.onclose = (ev) => this.onClose(ev);
|
|
@@ -2277,17 +2301,13 @@ var Socket = class {
|
|
|
2277
2301
|
this.lastPingTime = void 0;
|
|
2278
2302
|
this.satrtConfirm = false;
|
|
2279
2303
|
this.socketError = false;
|
|
2280
|
-
|
|
2281
|
-
this.callKit.logger.info("Closing socket connection", {
|
|
2282
|
-
caller: "Socket.reset",
|
|
2283
|
-
type: "INCALL",
|
|
2284
|
-
content: {}
|
|
2285
|
-
});
|
|
2286
|
-
this.ws.close();
|
|
2287
|
-
this.isConnected = false;
|
|
2288
|
-
}
|
|
2304
|
+
this.clearWebSocket();
|
|
2289
2305
|
}
|
|
2290
2306
|
attemptReconnect() {
|
|
2307
|
+
if (this.reconnectTimer) {
|
|
2308
|
+
clearTimeout(this.reconnectTimer);
|
|
2309
|
+
this.reconnectTimer = void 0;
|
|
2310
|
+
}
|
|
2291
2311
|
if (this.reconnectAttempts >= this.socketConfig.maxAttempts) {
|
|
2292
2312
|
this.callKit.trigger(KitEvent.INCALL_CONNECT_EVENT, {
|
|
2293
2313
|
event: "INCALL_RECONNECT_ERROR"
|