@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.js
CHANGED
|
@@ -620,7 +620,7 @@ var Call = class {
|
|
|
620
620
|
// package.json
|
|
621
621
|
var package_default = {
|
|
622
622
|
name: "@koi-design/callkit",
|
|
623
|
-
version: "2.0.
|
|
623
|
+
version: "2.0.2",
|
|
624
624
|
description: "callkit",
|
|
625
625
|
author: "koi",
|
|
626
626
|
license: "ISC",
|
|
@@ -1924,9 +1924,33 @@ var Socket = class {
|
|
|
1924
1924
|
});
|
|
1925
1925
|
return;
|
|
1926
1926
|
}
|
|
1927
|
+
if (this.isReconnecting) {
|
|
1928
|
+
return;
|
|
1929
|
+
}
|
|
1927
1930
|
this.attemptReconnect();
|
|
1928
1931
|
}
|
|
1932
|
+
clearWebSocket() {
|
|
1933
|
+
if (this.ws) {
|
|
1934
|
+
this.ws.onopen = null;
|
|
1935
|
+
this.ws.onclose = null;
|
|
1936
|
+
this.ws.onerror = null;
|
|
1937
|
+
this.ws.onmessage = null;
|
|
1938
|
+
}
|
|
1939
|
+
if (this.ws.readyState === WebSocket.CONNECTING || this.ws.readyState === WebSocket.OPEN) {
|
|
1940
|
+
this.ws.close();
|
|
1941
|
+
this.callKit.logger.info("socket clear", {
|
|
1942
|
+
caller: "Socket.clearWebSocket",
|
|
1943
|
+
type: "INCALL",
|
|
1944
|
+
content: {}
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
this.ws = void 0;
|
|
1948
|
+
this.isConnected = false;
|
|
1949
|
+
}
|
|
1929
1950
|
connect(socketUrl) {
|
|
1951
|
+
if (this.ws) {
|
|
1952
|
+
this.clearWebSocket();
|
|
1953
|
+
}
|
|
1930
1954
|
this.ws = new WebSocket(socketUrl);
|
|
1931
1955
|
this.ws.onopen = (ev) => this.onOpen(ev);
|
|
1932
1956
|
this.ws.onclose = (ev) => this.onClose(ev);
|
|
@@ -2304,17 +2328,13 @@ var Socket = class {
|
|
|
2304
2328
|
this.lastPingTime = void 0;
|
|
2305
2329
|
this.satrtConfirm = false;
|
|
2306
2330
|
this.socketError = false;
|
|
2307
|
-
|
|
2308
|
-
this.callKit.logger.info("Closing socket connection", {
|
|
2309
|
-
caller: "Socket.reset",
|
|
2310
|
-
type: "INCALL",
|
|
2311
|
-
content: {}
|
|
2312
|
-
});
|
|
2313
|
-
this.ws.close();
|
|
2314
|
-
this.isConnected = false;
|
|
2315
|
-
}
|
|
2331
|
+
this.clearWebSocket();
|
|
2316
2332
|
}
|
|
2317
2333
|
attemptReconnect() {
|
|
2334
|
+
if (this.reconnectTimer) {
|
|
2335
|
+
clearTimeout(this.reconnectTimer);
|
|
2336
|
+
this.reconnectTimer = void 0;
|
|
2337
|
+
}
|
|
2318
2338
|
if (this.reconnectAttempts >= this.socketConfig.maxAttempts) {
|
|
2319
2339
|
this.callKit.trigger(KitEvent.INCALL_CONNECT_EVENT, {
|
|
2320
2340
|
event: "INCALL_RECONNECT_ERROR"
|