@vkontakte/calls-sdk 2.8.13-beta.0 → 2.8.13-dev.0b862caf.0
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/calls-sdk.cjs.js +4 -4
- package/calls-sdk.esm.js +35 -11
- package/default/SignalingTransport.d.ts +5 -1
- package/package.json +1 -1
- package/static/Params.d.ts +3 -0
package/calls-sdk.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @vkontakte/calls-sdk v2.8.13-
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/calls-sdk v2.8.13-dev.0b862caf.0
|
|
3
|
+
* Tue, 15 Sep 2026 20:28:59 GMT
|
|
4
4
|
* https://calls-sdk.cdn-vk.ru/doc/latest/index.html
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -2155,7 +2155,7 @@ var yn = vn.getInstance(), M = class e {
|
|
|
2155
2155
|
return 1.1;
|
|
2156
2156
|
}
|
|
2157
2157
|
static get sdkVersion() {
|
|
2158
|
-
return "2.8.13-
|
|
2158
|
+
return "2.8.13-dev.0b862caf.0";
|
|
2159
2159
|
}
|
|
2160
2160
|
static get debug() {
|
|
2161
2161
|
return e._params.debug;
|
|
@@ -2275,6 +2275,9 @@ var yn = vn.getInstance(), M = class e {
|
|
|
2275
2275
|
static get signalingReconnectMaxCount() {
|
|
2276
2276
|
return e._params.signalingReconnectMaxCount;
|
|
2277
2277
|
}
|
|
2278
|
+
static get signalingReconnectMaxDuration() {
|
|
2279
|
+
return e._params.signalingReconnectMaxDuration;
|
|
2280
|
+
}
|
|
2278
2281
|
static get waitConnectionDelay() {
|
|
2279
2282
|
return e._params.waitConnectionDelay;
|
|
2280
2283
|
}
|
|
@@ -2610,6 +2613,7 @@ h(M, "_params", {
|
|
|
2610
2613
|
signalingReconnectDelay: 1e3,
|
|
2611
2614
|
signalingReconnectMaxDelay: 5e3,
|
|
2612
2615
|
signalingReconnectMaxCount: 10,
|
|
2616
|
+
signalingReconnectMaxDuration: 6e4,
|
|
2613
2617
|
waitConnectionDelay: 1e4,
|
|
2614
2618
|
waitResponseDelay: 1e4,
|
|
2615
2619
|
waitMessageDelay: 15e3,
|
|
@@ -6921,10 +6925,10 @@ var ya = va, ba = {
|
|
|
6921
6925
|
}, n;
|
|
6922
6926
|
}
|
|
6923
6927
|
}, ja = /* @__PURE__ */ function(e) {
|
|
6924
|
-
return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.NETWORK_ERROR = "NETWORK_ERROR", e.ABORTED = "ABORTED", e;
|
|
6928
|
+
return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.NETWORK_ERROR = "NETWORK_ERROR", e.RECONNECT_TIMEOUT = "RECONNECT_TIMEOUT", e.ABORTED = "ABORTED", e;
|
|
6925
6929
|
}({}), Ma = class {
|
|
6926
6930
|
constructor(e = R, t) {
|
|
6927
|
-
h(this, "handlers", void 0), h(this, "socket", null), h(this, "endpoint", ""), h(this, "wtEndpoint", null), h(this, "peerId", null), h(this, "lastStamp", 0), h(this, "connectionType", void 0), h(this, "reconnectCount", 0), h(this, "reconnectTimer", 0), h(this, "doctorTimer", 0), h(this, "forceWebSocket", !1), h(this, "abortSignal", void 0), h(this, "manualClose", !1), h(this, "currentType", yr.WEBSOCKET), h(this, "_debug", void 0), this.handlers = t, this._debug = e;
|
|
6931
|
+
h(this, "handlers", void 0), h(this, "socket", null), h(this, "endpoint", ""), h(this, "wtEndpoint", null), h(this, "peerId", null), h(this, "lastStamp", 0), h(this, "connectionType", void 0), h(this, "reconnectCount", 0), h(this, "reconnectTimer", 0), h(this, "reconnectDeadlineTimer", 0), h(this, "doctorTimer", 0), h(this, "forceWebSocket", !1), h(this, "abortSignal", void 0), h(this, "manualClose", !1), h(this, "currentType", yr.WEBSOCKET), h(this, "_debug", void 0), this.handlers = t, this._debug = e;
|
|
6928
6932
|
}
|
|
6929
6933
|
get readyState() {
|
|
6930
6934
|
return this.socket?.readyState ?? null;
|
|
@@ -6947,14 +6951,14 @@ var ya = va, ba = {
|
|
|
6947
6951
|
setAbortSignal(e) {
|
|
6948
6952
|
this.abortSignal = e;
|
|
6949
6953
|
}
|
|
6950
|
-
|
|
6951
|
-
this.reconnectCount = 0;
|
|
6954
|
+
onConnectionRestored() {
|
|
6955
|
+
this.reconnectCount = 0, this._stopReconnectDeadline();
|
|
6952
6956
|
}
|
|
6953
6957
|
connect(e) {
|
|
6954
6958
|
this.socket && this.socket.readyState < WebSocket.CLOSING || (e !== vr.RETRY && (this.forceWebSocket = !1, this.reconnectCount = 0), this.manualClose = !1, this.connectionType = e, this._connect());
|
|
6955
6959
|
}
|
|
6956
6960
|
close(e) {
|
|
6957
|
-
this.manualClose = !0, this._disconnect(e), window.clearTimeout(this.reconnectTimer), this.reconnectTimer = 0, this.lastStamp = 0;
|
|
6961
|
+
this.manualClose = !0, this._disconnect(e), window.clearTimeout(this.reconnectTimer), this.reconnectTimer = 0, this._stopReconnectDeadline(), this.lastStamp = 0;
|
|
6958
6962
|
}
|
|
6959
6963
|
async send(e) {
|
|
6960
6964
|
await this.socket?.send(e);
|
|
@@ -7027,20 +7031,32 @@ var ya = va, ba = {
|
|
|
7027
7031
|
}
|
|
7028
7032
|
_scheduleReconnect(e = this._getReconnectDelay()) {
|
|
7029
7033
|
if (this.reconnectCount >= M.signalingReconnectMaxCount) {
|
|
7030
|
-
this.handlers.onFailed({
|
|
7034
|
+
this._stopReconnectDeadline(), this.handlers.onFailed({
|
|
7031
7035
|
failure: "NETWORK_ERROR",
|
|
7032
7036
|
message: "Unable to connect to the signaling: reconnect attempts exhausted",
|
|
7033
7037
|
source: this.currentType
|
|
7034
7038
|
});
|
|
7035
7039
|
return;
|
|
7036
7040
|
}
|
|
7037
|
-
this.reconnectCount++, this.handlers.onReconnectScheduled({
|
|
7041
|
+
this._startReconnectDeadline(), this.reconnectCount++, this.handlers.onReconnectScheduled({
|
|
7038
7042
|
count: this.reconnectCount,
|
|
7039
7043
|
delay: e
|
|
7040
7044
|
}), this.reconnectTimer = window.setTimeout(() => {
|
|
7041
7045
|
this.connectionType = vr.RETRY, this._connect();
|
|
7042
7046
|
}, e);
|
|
7043
7047
|
}
|
|
7048
|
+
_startReconnectDeadline() {
|
|
7049
|
+
this.reconnectDeadlineTimer || (this.reconnectDeadlineTimer = window.setTimeout(() => {
|
|
7050
|
+
this.reconnectDeadlineTimer = 0, window.clearTimeout(this.reconnectTimer), this.reconnectTimer = 0, this._disconnect(4e3), this.handlers.onFailed({
|
|
7051
|
+
failure: "RECONNECT_TIMEOUT",
|
|
7052
|
+
message: "Unable to connect to the signaling: reconnect timeout",
|
|
7053
|
+
source: this.currentType
|
|
7054
|
+
});
|
|
7055
|
+
}, M.signalingReconnectMaxDuration));
|
|
7056
|
+
}
|
|
7057
|
+
_stopReconnectDeadline() {
|
|
7058
|
+
window.clearTimeout(this.reconnectDeadlineTimer), this.reconnectDeadlineTimer = 0;
|
|
7059
|
+
}
|
|
7044
7060
|
_getReconnectDelay() {
|
|
7045
7061
|
return Math.min(M.signalingReconnectMaxDelay, M.signalingReconnectDelay * 2 ** this.reconnectCount);
|
|
7046
7062
|
}
|
|
@@ -7469,7 +7485,7 @@ var Ra = new Set([
|
|
|
7469
7485
|
_handleMessage(e) {
|
|
7470
7486
|
switch (e.type) {
|
|
7471
7487
|
case "notification":
|
|
7472
|
-
this._attachNotificationCallError(e), e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.transport.
|
|
7488
|
+
this._attachNotificationCallError(e), e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.transport.onConnectionRestored(), this.transport.setEndpoint(e.endpoint), e.peerId && this.peerId !== e.peerId.id && (this.peerId = e.peerId.id, this.transport.setPeerId(e.peerId.id)), this._stopWaitConnectionMessage(), this.conversationResolve ? this.conversationResolve(e) : (this._logTransportStat(br.RESTART), this._triggerEvent(G.RECONNECT, e), e.conversation.topology && this._triggerEvent(G.NOTIFICATION, {
|
|
7473
7489
|
type: "notification",
|
|
7474
7490
|
notification: K.TOPOLOGY_CHANGED,
|
|
7475
7491
|
topology: e.conversation.topology
|
|
@@ -7741,6 +7757,14 @@ var Ra = new Set([
|
|
|
7741
7757
|
description: "connection-failed"
|
|
7742
7758
|
} }));
|
|
7743
7759
|
break;
|
|
7760
|
+
case ja.RECONNECT_TIMEOUT:
|
|
7761
|
+
this._fail(new O(D.NETWORK_ERROR, { callError: {
|
|
7762
|
+
scope: "network",
|
|
7763
|
+
source: e.source,
|
|
7764
|
+
code: "reconnect-timeout",
|
|
7765
|
+
description: "connection-failed"
|
|
7766
|
+
} }));
|
|
7767
|
+
break;
|
|
7744
7768
|
case ja.ABORTED:
|
|
7745
7769
|
this._debug.debug("[signaling] aborted reconnect"), this._fail(new O(D.CANCELED));
|
|
7746
7770
|
break;
|
|
@@ -4,6 +4,7 @@ import { DebugLogger } from '../static/Debug';
|
|
|
4
4
|
export declare enum SignalingTransportFailure {
|
|
5
5
|
EMPTY_ENDPOINT = "EMPTY_ENDPOINT",
|
|
6
6
|
NETWORK_ERROR = "NETWORK_ERROR",
|
|
7
|
+
RECONNECT_TIMEOUT = "RECONNECT_TIMEOUT",
|
|
7
8
|
ABORTED = "ABORTED"
|
|
8
9
|
}
|
|
9
10
|
export type SignalingTransportFailedEvent = {
|
|
@@ -40,6 +41,7 @@ export default class SignalingTransport {
|
|
|
40
41
|
private connectionType;
|
|
41
42
|
private reconnectCount;
|
|
42
43
|
private reconnectTimer;
|
|
44
|
+
private reconnectDeadlineTimer;
|
|
43
45
|
private doctorTimer;
|
|
44
46
|
private forceWebSocket;
|
|
45
47
|
private abortSignal;
|
|
@@ -54,7 +56,7 @@ export default class SignalingTransport {
|
|
|
54
56
|
setPeerId(peerId: number | null): void;
|
|
55
57
|
setLastStamp(lastStamp: number): void;
|
|
56
58
|
setAbortSignal(signal?: AbortSignal): void;
|
|
57
|
-
|
|
59
|
+
onConnectionRestored(): void;
|
|
58
60
|
connect(connectionType: SignalingConnectionType): void;
|
|
59
61
|
close(code?: number): void;
|
|
60
62
|
send(data: string | ArrayBuffer): Promise<void>;
|
|
@@ -70,6 +72,8 @@ export default class SignalingTransport {
|
|
|
70
72
|
private _onClose;
|
|
71
73
|
private _disconnect;
|
|
72
74
|
private _scheduleReconnect;
|
|
75
|
+
private _startReconnectDeadline;
|
|
76
|
+
private _stopReconnectDeadline;
|
|
73
77
|
private _getReconnectDelay;
|
|
74
78
|
private _startDoctor;
|
|
75
79
|
private _stopDoctor;
|
package/package.json
CHANGED
package/static/Params.d.ts
CHANGED
|
@@ -93,6 +93,8 @@ export type ParamsObject = {
|
|
|
93
93
|
/** @hidden */
|
|
94
94
|
signalingReconnectMaxCount: number;
|
|
95
95
|
/** @hidden */
|
|
96
|
+
signalingReconnectMaxDuration: number;
|
|
97
|
+
/** @hidden */
|
|
96
98
|
waitConnectionDelay: number;
|
|
97
99
|
/** @hidden */
|
|
98
100
|
waitResponseDelay: number;
|
|
@@ -964,6 +966,7 @@ export default abstract class Params {
|
|
|
964
966
|
static get signalingReconnectDelay(): number;
|
|
965
967
|
static get signalingReconnectMaxDelay(): number;
|
|
966
968
|
static get signalingReconnectMaxCount(): number;
|
|
969
|
+
static get signalingReconnectMaxDuration(): number;
|
|
967
970
|
static get waitConnectionDelay(): number;
|
|
968
971
|
static get waitResponseDelay(): number;
|
|
969
972
|
static get waitMessageDelay(): number;
|