@vkontakte/calls-sdk 2.8.11-dev.4bbae276.0 → 2.8.11-dev.7ac19827.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 +10 -10
- package/calls-sdk.esm.js +10 -10
- package/classes/ConversationResponseValidator.d.ts +3 -0
- package/default/Signaling.d.ts +27 -42
- package/default/SignalingTransport.d.ts +68 -0
- package/package.json +1 -1
- package/types/WebTransport.d.ts +5 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import ConversationResponse from '../types/ConversationResponse';
|
|
2
|
+
export type ConversationResponseSource = 'startConversation' | 'joinConversation' | 'joinConversationByLink' | 'fastStart' | 'fastJoin';
|
|
3
|
+
export declare function assertValidConversationResponse(response: ConversationResponse | null | undefined, source: ConversationResponseSource): void;
|
package/default/Signaling.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { TransportTopology } from '../classes/transport/Transport';
|
|
|
5
5
|
import ConversationFeature from '../enums/ConversationFeature';
|
|
6
6
|
import ConversationOption from '../enums/ConversationOption';
|
|
7
7
|
import MediaOption from '../enums/MediaOption';
|
|
8
|
-
import SignalingCommandType from '../enums/SignalingCommandType';
|
|
9
8
|
import SignalingConnectionType from '../enums/SignalingConnectionType';
|
|
10
9
|
import UserRole from '../enums/UserRole';
|
|
11
10
|
import { JSONObject } from '../static/Json';
|
|
@@ -21,42 +20,33 @@ import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/Partici
|
|
|
21
20
|
import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
|
|
22
21
|
import { StreamDescriptionString } from '../types/ParticipantStreamDescription';
|
|
23
22
|
import { PerfStatReport } from '../types/PerfStatReporter';
|
|
24
|
-
import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse
|
|
23
|
+
import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse } from '../types/SignalingMessage';
|
|
25
24
|
import { IPublishStreamData, IRecordConfData, IStartStreamData, IStopStreamData } from '../types/Streams';
|
|
26
25
|
export default class Signaling extends BaseSignaling {
|
|
27
|
-
private
|
|
28
|
-
|
|
26
|
+
private transport;
|
|
27
|
+
private sequence;
|
|
29
28
|
private lastStamp;
|
|
30
29
|
private websocketCommandsQueue;
|
|
31
30
|
private datachannelCommandsQueue;
|
|
32
31
|
private incomingCache;
|
|
33
32
|
private responseHandlers;
|
|
34
33
|
private connectionType;
|
|
35
|
-
private
|
|
36
|
-
private
|
|
37
|
-
private wtEndpoint;
|
|
38
|
-
protected conversationResolve: Function | null;
|
|
39
|
-
protected conversationReject: Function | null;
|
|
34
|
+
private conversationResolve;
|
|
35
|
+
private conversationReject;
|
|
40
36
|
private connected;
|
|
41
37
|
private listenersReady;
|
|
42
|
-
private
|
|
43
|
-
|
|
44
|
-
protected conversationId: string | null;
|
|
45
|
-
private reconnectTimer;
|
|
38
|
+
private peerId;
|
|
39
|
+
private conversationId;
|
|
46
40
|
private connectionMessageWaitTimer;
|
|
47
|
-
private doctorTimer;
|
|
48
41
|
private participantIdRegistry;
|
|
49
42
|
private producerNotificationDataChannel;
|
|
50
43
|
private producerCommandDataChannel;
|
|
51
44
|
private producerCommandDataChannelEnabled;
|
|
52
45
|
private producerCommandSerializationService;
|
|
53
|
-
private static get RECONNECT_DELAY();
|
|
54
|
-
private static get RECONNECT_MAX_DELAY();
|
|
55
|
-
private static get RECONNECT_MAX_COUNT();
|
|
56
46
|
private static get WAIT_CONNECTION_DELAY();
|
|
57
47
|
private static get WAIT_RESPONSE_DELAY();
|
|
58
|
-
private static get WAIT_MESSAGE_DELAY();
|
|
59
48
|
get ready(): boolean;
|
|
49
|
+
setAbortSignal(signal: AbortSignal | undefined): void;
|
|
60
50
|
setEndpoint(endpoint: string): void;
|
|
61
51
|
setWebTransportEndpoint(endpoint: string | null): void;
|
|
62
52
|
setConversationId(conversationId: string): void;
|
|
@@ -72,15 +62,6 @@ export default class Signaling extends BaseSignaling {
|
|
|
72
62
|
* Open a connection with a signaling server
|
|
73
63
|
*/
|
|
74
64
|
connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
|
|
75
|
-
/**
|
|
76
|
-
* Send a command to a signaling server
|
|
77
|
-
*/
|
|
78
|
-
protected _send<T extends SignalingSuccessResponse>(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<T>;
|
|
79
|
-
/**
|
|
80
|
-
* Send a raw command to a signaling server
|
|
81
|
-
*/
|
|
82
|
-
protected _sendRaw<T extends SignalingSuccessResponse>(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<T>;
|
|
83
|
-
private _isDataChannelCommand;
|
|
84
65
|
getNextCommandSequenceNumber(): number;
|
|
85
66
|
hangup(reason: string): Promise<SignalingMessage | void>;
|
|
86
67
|
sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidate): Promise<SignalingMessage>;
|
|
@@ -164,32 +145,36 @@ export default class Signaling extends BaseSignaling {
|
|
|
164
145
|
startAsr(params: IAsrStartParams): Promise<SignalingMessage>;
|
|
165
146
|
stopAsr(params?: IAsrStopParams): Promise<SignalingMessage>;
|
|
166
147
|
requestAsr(request: boolean): Promise<SignalingMessage>;
|
|
167
|
-
|
|
168
|
-
|
|
148
|
+
/**
|
|
149
|
+
* Send a command to a signaling server
|
|
150
|
+
*/
|
|
151
|
+
private _send;
|
|
152
|
+
/**
|
|
153
|
+
* Send a raw command to a signaling server
|
|
154
|
+
*/
|
|
155
|
+
private _sendRaw;
|
|
156
|
+
private _isDataChannelCommand;
|
|
169
157
|
private _onOpen;
|
|
170
158
|
private _onMessage;
|
|
171
|
-
|
|
159
|
+
private _handleMessage;
|
|
172
160
|
private _handleErrorMessage;
|
|
173
|
-
|
|
161
|
+
private _handleCachedMessages;
|
|
174
162
|
private _throwError;
|
|
175
163
|
private _onError;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
164
|
+
private _serializeErrorEvent;
|
|
165
|
+
private _onClose;
|
|
166
|
+
private _closeSocket;
|
|
179
167
|
private _handleCommandResponse;
|
|
180
168
|
private _handleCommandsQueue;
|
|
181
169
|
private _startResponseTimer;
|
|
182
170
|
private _serializeBinary;
|
|
183
171
|
private _serializeJson;
|
|
184
172
|
private _convertDisplayLayout;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
private _startDoctor;
|
|
191
|
-
private _stopDoctor;
|
|
192
|
-
private isWebTransportAvailable;
|
|
173
|
+
private _waitConnectionMessage;
|
|
174
|
+
private _stopWaitConnectionMessage;
|
|
175
|
+
private _onTransportFailed;
|
|
176
|
+
private _onTransportReconnectScheduled;
|
|
177
|
+
private _onTransportConnectionDead;
|
|
193
178
|
private _getSocketType;
|
|
194
179
|
private _markTransportStat;
|
|
195
180
|
private _logTransportStat;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import SignalingConnectionType from '../enums/SignalingConnectionType';
|
|
2
|
+
import { SignalingTransportType } from '../enums/SignalingTransportStat';
|
|
3
|
+
export declare enum SignalingTransportFailure {
|
|
4
|
+
EMPTY_ENDPOINT = "EMPTY_ENDPOINT",
|
|
5
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
6
|
+
ABORTED = "ABORTED"
|
|
7
|
+
}
|
|
8
|
+
export type SignalingTransportFailedEvent = {
|
|
9
|
+
failure: SignalingTransportFailure;
|
|
10
|
+
message: string;
|
|
11
|
+
remote?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type SignalingTransportReconnectEvent = {
|
|
14
|
+
count: number;
|
|
15
|
+
delay: number;
|
|
16
|
+
};
|
|
17
|
+
export type SignalingTransportHandlers = {
|
|
18
|
+
onOpen: () => void;
|
|
19
|
+
onMessage: (event: MessageEvent) => void;
|
|
20
|
+
onError: (event: Event) => void;
|
|
21
|
+
onClose: (event: CloseEvent) => void;
|
|
22
|
+
onFailed: (event: SignalingTransportFailedEvent) => void;
|
|
23
|
+
onReconnectScheduled: (event: SignalingTransportReconnectEvent) => void;
|
|
24
|
+
onConnectionDead: () => void;
|
|
25
|
+
};
|
|
26
|
+
export default class SignalingTransport {
|
|
27
|
+
private readonly handlers;
|
|
28
|
+
private socket;
|
|
29
|
+
private endpoint;
|
|
30
|
+
private wtEndpoint;
|
|
31
|
+
private peerId;
|
|
32
|
+
private lastStamp;
|
|
33
|
+
private connectionType;
|
|
34
|
+
private reconnectCount;
|
|
35
|
+
private reconnectTimer;
|
|
36
|
+
private doctorTimer;
|
|
37
|
+
private forceWebSocket;
|
|
38
|
+
private abortSignal;
|
|
39
|
+
private manualClose;
|
|
40
|
+
private currentType;
|
|
41
|
+
constructor(handlers: SignalingTransportHandlers);
|
|
42
|
+
get readyState(): number | null;
|
|
43
|
+
get type(): SignalingTransportType;
|
|
44
|
+
setEndpoint(endpoint: string): void;
|
|
45
|
+
setWebTransportEndpoint(endpoint: string | null): void;
|
|
46
|
+
setPeerId(peerId: number | null): void;
|
|
47
|
+
setLastStamp(lastStamp: number): void;
|
|
48
|
+
setAbortSignal(signal?: AbortSignal): void;
|
|
49
|
+
resetReconnectCount(): void;
|
|
50
|
+
connect(connectionType: SignalingConnectionType): void;
|
|
51
|
+
close(code?: number): void;
|
|
52
|
+
send(data: string | ArrayBuffer): void;
|
|
53
|
+
private _connect;
|
|
54
|
+
private _connectWebTransport;
|
|
55
|
+
private _connectWebSocket;
|
|
56
|
+
private _setSocketHandlers;
|
|
57
|
+
private _buildUrl;
|
|
58
|
+
private _canUseWebTransport;
|
|
59
|
+
private _onOpen;
|
|
60
|
+
private _onMessage;
|
|
61
|
+
private _onError;
|
|
62
|
+
private _onClose;
|
|
63
|
+
private _disconnect;
|
|
64
|
+
private _scheduleReconnect;
|
|
65
|
+
private _getReconnectDelay;
|
|
66
|
+
private _startDoctor;
|
|
67
|
+
private _stopDoctor;
|
|
68
|
+
}
|
package/package.json
CHANGED
package/types/WebTransport.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ declare class WebTransportEventual {
|
|
|
7
7
|
private readonly url;
|
|
8
8
|
private readonly options;
|
|
9
9
|
private readonly compression;
|
|
10
|
+
private closeRequested;
|
|
11
|
+
private closeEventEmitted;
|
|
10
12
|
private encoder;
|
|
11
13
|
private decoder;
|
|
12
14
|
onopen: ((this: WebTransportEventual, ev: Event) => any) | null;
|
|
@@ -20,7 +22,10 @@ declare class WebTransportEventual {
|
|
|
20
22
|
private readChunks;
|
|
21
23
|
private readLoop;
|
|
22
24
|
send(data: string): Promise<void>;
|
|
25
|
+
private createErrorEvent;
|
|
23
26
|
close(code?: number, reason?: string): void;
|
|
27
|
+
private closeConnectedTransport;
|
|
28
|
+
private emitClose;
|
|
24
29
|
static isBrowserSupported(): boolean;
|
|
25
30
|
}
|
|
26
31
|
export { WebTransportEventual as WebTransport };
|