livekit-client 2.18.0 → 2.18.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/livekit-client.e2ee.worker.js +1 -1
- package/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs +8 -7
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +8026 -5883
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/api/SignalClient.d.ts +12 -4
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/connectionHelper/ConnectionCheck.d.ts +1 -1
- package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
- package/dist/src/e2ee/constants.d.ts.map +1 -1
- package/dist/src/e2ee/types.d.ts +6 -0
- package/dist/src/e2ee/types.d.ts.map +1 -1
- package/dist/src/e2ee/utils.d.ts +2 -1
- package/dist/src/e2ee/utils.d.ts.map +1 -1
- package/dist/src/e2ee/worker/DataCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +5 -0
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/PCTransportManager.d.ts +1 -1
- package/dist/src/room/PCTransportManager.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +28 -11
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +14 -3
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/data-stream/incoming/IncomingDataStreamManager.d.ts +5 -1
- package/dist/src/room/data-stream/incoming/IncomingDataStreamManager.d.ts.map +1 -1
- package/dist/src/room/data-stream/outgoing/OutgoingDataStreamManager.d.ts.map +1 -1
- package/dist/src/room/data-track/LocalDataTrack.d.ts +28 -5
- package/dist/src/room/data-track/LocalDataTrack.d.ts.map +1 -1
- package/dist/src/room/data-track/RemoteDataTrack.d.ts +5 -5
- package/dist/src/room/data-track/RemoteDataTrack.d.ts.map +1 -1
- package/dist/src/room/data-track/depacketizer.d.ts +4 -4
- package/dist/src/room/data-track/depacketizer.d.ts.map +1 -1
- package/dist/src/room/data-track/frame.d.ts +14 -0
- package/dist/src/room/data-track/frame.d.ts.map +1 -1
- package/dist/src/room/data-track/incoming/IncomingDataTrackManager.d.ts +19 -11
- package/dist/src/room/data-track/incoming/IncomingDataTrackManager.d.ts.map +1 -1
- package/dist/src/room/data-track/incoming/pipeline.d.ts +6 -5
- package/dist/src/room/data-track/incoming/pipeline.d.ts.map +1 -1
- package/dist/src/room/data-track/outgoing/OutgoingDataTrackManager.d.ts +57 -23
- package/dist/src/room/data-track/outgoing/OutgoingDataTrackManager.d.ts.map +1 -1
- package/dist/src/room/data-track/outgoing/errors.d.ts +16 -6
- package/dist/src/room/data-track/outgoing/errors.d.ts.map +1 -1
- package/dist/src/room/data-track/outgoing/pipeline.d.ts +7 -6
- package/dist/src/room/data-track/outgoing/pipeline.d.ts.map +1 -1
- package/dist/src/room/data-track/outgoing/types.d.ts +14 -4
- package/dist/src/room/data-track/outgoing/types.d.ts.map +1 -1
- package/dist/src/room/data-track/packet/extensions.d.ts.map +1 -1
- package/dist/src/room/data-track/packetizer.d.ts +4 -4
- package/dist/src/room/data-track/packetizer.d.ts.map +1 -1
- package/dist/src/room/data-track/track-interfaces.d.ts +1 -1
- package/dist/src/room/data-track/track-interfaces.d.ts.map +1 -1
- package/dist/src/room/data-track/types.d.ts +6 -1
- package/dist/src/room/data-track/types.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +24 -3
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +12 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts +13 -0
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +1 -0
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/src/utils/deferrable-map.d.ts +32 -0
- package/dist/src/utils/deferrable-map.d.ts.map +1 -0
- package/dist/src/utils/serializer.d.ts +48 -0
- package/dist/src/utils/serializer.d.ts.map +1 -0
- package/dist/ts4.2/api/SignalClient.d.ts +12 -4
- package/dist/ts4.2/connectionHelper/ConnectionCheck.d.ts +2 -1
- package/dist/ts4.2/e2ee/types.d.ts +6 -0
- package/dist/ts4.2/e2ee/utils.d.ts +2 -1
- package/dist/ts4.2/index.d.ts +7 -4
- package/dist/ts4.2/room/PCTransport.d.ts +5 -0
- package/dist/ts4.2/room/PCTransportManager.d.ts +1 -1
- package/dist/ts4.2/room/RTCEngine.d.ts +28 -11
- package/dist/ts4.2/room/Room.d.ts +14 -3
- package/dist/ts4.2/room/data-stream/incoming/IncomingDataStreamManager.d.ts +5 -1
- package/dist/ts4.2/room/data-track/LocalDataTrack.d.ts +27 -4
- package/dist/ts4.2/room/data-track/RemoteDataTrack.d.ts +4 -4
- package/dist/ts4.2/room/data-track/depacketizer.d.ts +4 -4
- package/dist/ts4.2/room/data-track/frame.d.ts +14 -0
- package/dist/ts4.2/room/data-track/incoming/IncomingDataTrackManager.d.ts +21 -10
- package/dist/ts4.2/room/data-track/incoming/pipeline.d.ts +6 -5
- package/dist/ts4.2/room/data-track/outgoing/OutgoingDataTrackManager.d.ts +57 -23
- package/dist/ts4.2/room/data-track/outgoing/errors.d.ts +16 -6
- package/dist/ts4.2/room/data-track/outgoing/pipeline.d.ts +7 -6
- package/dist/ts4.2/room/data-track/outgoing/types.d.ts +14 -4
- package/dist/ts4.2/room/data-track/packetizer.d.ts +4 -4
- package/dist/ts4.2/room/data-track/track-interfaces.d.ts +1 -1
- package/dist/ts4.2/room/data-track/types.d.ts +6 -1
- package/dist/ts4.2/room/events.d.ts +24 -3
- package/dist/ts4.2/room/participant/LocalParticipant.d.ts +12 -1
- package/dist/ts4.2/room/participant/RemoteParticipant.d.ts +13 -0
- package/dist/ts4.2/room/utils.d.ts +1 -0
- package/dist/ts4.2/utils/deferrable-map.d.ts +32 -0
- package/dist/ts4.2/utils/serializer.d.ts +48 -0
- package/package.json +1 -1
- package/src/api/SignalClient.test.ts +9 -4
- package/src/api/SignalClient.ts +116 -9
- package/src/connectionHelper/ConnectionCheck.ts +1 -1
- package/src/e2ee/constants.ts +1 -0
- package/src/e2ee/types.ts +6 -0
- package/src/e2ee/utils.ts +4 -3
- package/src/e2ee/worker/DataCryptor.ts +1 -4
- package/src/e2ee/worker/FrameCryptor.ts +1 -4
- package/src/e2ee/worker/ParticipantKeyHandler.ts +1 -1
- package/src/index.ts +13 -4
- package/src/room/PCTransport.ts +41 -1
- package/src/room/PCTransportManager.ts +1 -1
- package/src/room/RTCEngine.ts +312 -125
- package/src/room/Room.ts +168 -35
- package/src/room/data-stream/incoming/IncomingDataStreamManager.ts +26 -2
- package/src/room/data-stream/outgoing/OutgoingDataStreamManager.ts +7 -7
- package/src/room/data-track/LocalDataTrack.ts +83 -10
- package/src/room/data-track/RemoteDataTrack.ts +7 -9
- package/src/room/data-track/depacketizer.ts +21 -12
- package/src/room/data-track/frame.ts +28 -2
- package/src/room/data-track/incoming/IncomingDataTrackManager.test.ts +58 -73
- package/src/room/data-track/incoming/IncomingDataTrackManager.ts +139 -80
- package/src/room/data-track/incoming/pipeline.ts +29 -24
- package/src/room/data-track/outgoing/OutgoingDataTrackManager.test.ts +225 -32
- package/src/room/data-track/outgoing/OutgoingDataTrackManager.ts +150 -75
- package/src/room/data-track/outgoing/errors.ts +36 -7
- package/src/room/data-track/outgoing/pipeline.ts +23 -17
- package/src/room/data-track/outgoing/types.ts +12 -3
- package/src/room/data-track/packet/extensions.ts +17 -22
- package/src/room/data-track/packet/index.test.ts +22 -33
- package/src/room/data-track/packetizer.test.ts +2 -2
- package/src/room/data-track/packetizer.ts +4 -4
- package/src/room/data-track/track-interfaces.ts +1 -1
- package/src/room/data-track/types.ts +21 -1
- package/src/room/events.ts +26 -1
- package/src/room/participant/LocalParticipant.ts +74 -8
- package/src/room/participant/RemoteParticipant.ts +25 -0
- package/src/room/utils.ts +4 -0
- package/src/utils/deferrable-map.ts +109 -0
- package/src/utils/serializer.ts +72 -0
- package/dist/src/room/data-track/e2ee.d.ts +0 -12
- package/dist/src/room/data-track/e2ee.d.ts.map +0 -1
- package/dist/ts4.2/room/data-track/e2ee.d.ts +0 -12
- package/src/room/data-track/e2ee.ts +0 -15
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { BaseE2EEManager } from '../../../e2ee/E2eeManager';
|
|
3
|
+
import type { DataTrackFrameInternal } from '../frame';
|
|
4
4
|
import { DataTrackPacket } from '../packet';
|
|
5
5
|
import type { DataTrackInfo } from '../types';
|
|
6
6
|
import { DataTrackOutgoingPipelineError, DataTrackOutgoingPipelineErrorReason } from './errors';
|
|
7
7
|
type Options = {
|
|
8
8
|
info: DataTrackInfo;
|
|
9
|
-
|
|
9
|
+
e2eeManager: BaseE2EEManager | null;
|
|
10
10
|
};
|
|
11
11
|
/** Processes outgoing frames into final packets for distribution to the SFU. */
|
|
12
12
|
export default class DataTrackOutgoingPipeline {
|
|
13
|
-
private
|
|
13
|
+
private e2eeManager;
|
|
14
14
|
private packetizer;
|
|
15
15
|
/** Maximum transmission unit (MTU) of the transport. */
|
|
16
16
|
private static TRANSPORT_MTU_BYTES;
|
|
17
17
|
constructor(options: Options);
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
updateE2eeManager(e2eeManager: BaseE2EEManager | null): void;
|
|
19
|
+
processFrame(frame: DataTrackFrameInternal): Throws<AsyncGenerator<DataTrackPacket>, DataTrackOutgoingPipelineError>;
|
|
20
|
+
encryptIfNeeded(frame: DataTrackFrameInternal): Promise<Throws<DataTrackFrameInternal, DataTrackOutgoingPipelineError<DataTrackOutgoingPipelineErrorReason.Encryption>>>;
|
|
20
21
|
}
|
|
21
22
|
export {};
|
|
22
23
|
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type LocalDataTrack from '../LocalDataTrack';
|
|
1
2
|
import type { DataTrackHandle } from '../handle';
|
|
2
|
-
import type { DataTrackInfo } from '../types';
|
|
3
|
+
import type { DataTrackInfo, DataTrackSid } from '../types';
|
|
3
4
|
import type { DataTrackPublishError, DataTrackPublishErrorReason } from './errors';
|
|
4
5
|
/** Options for publishing a data track. */
|
|
5
6
|
export type DataTrackOptions = {
|
|
@@ -11,7 +12,7 @@ export type SfuPublishResponseResult = {
|
|
|
11
12
|
data: DataTrackInfo;
|
|
12
13
|
} | {
|
|
13
14
|
type: 'error';
|
|
14
|
-
error: DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed> | DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName> | DataTrackPublishError<DataTrackPublishErrorReason.LimitReached>;
|
|
15
|
+
error: DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed> | DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName> | DataTrackPublishError<DataTrackPublishErrorReason.InvalidName> | DataTrackPublishError<DataTrackPublishErrorReason.LimitReached>;
|
|
15
16
|
};
|
|
16
17
|
/** Request sent to the SFU to publish a track. */
|
|
17
18
|
export type EventSfuPublishRequest = {
|
|
@@ -23,8 +24,17 @@ export type EventSfuPublishRequest = {
|
|
|
23
24
|
export type EventSfuUnpublishRequest = {
|
|
24
25
|
handle: DataTrackHandle;
|
|
25
26
|
};
|
|
26
|
-
/**
|
|
27
|
-
export type
|
|
27
|
+
/** A serialized packet is ready to be sent over the transport. */
|
|
28
|
+
export type EventPacketAvailable = {
|
|
28
29
|
bytes: Uint8Array;
|
|
29
30
|
};
|
|
31
|
+
/** A track has been created by a local participant and is available to be
|
|
32
|
+
* subscribed to. */
|
|
33
|
+
export type EventTrackPublished = {
|
|
34
|
+
track: LocalDataTrack;
|
|
35
|
+
};
|
|
36
|
+
/** A track has been unpublished by a remote participant and can no longer be subscribed to. */
|
|
37
|
+
export type EventTrackUnpublished = {
|
|
38
|
+
sid: DataTrackSid;
|
|
39
|
+
};
|
|
30
40
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
2
|
import { LivekitReasonedError } from '../errors';
|
|
3
|
-
import type {
|
|
3
|
+
import type { DataTrackFrameInternal } from './frame';
|
|
4
4
|
import { DataTrackHandle } from './handle';
|
|
5
5
|
import { DataTrackPacket, FrameMarker } from './packet';
|
|
6
6
|
import { DataTrackTimestamp } from './utils';
|
|
@@ -21,7 +21,7 @@ export declare class DataTrackPacketizerError<Reason extends DataTrackPacketizer
|
|
|
21
21
|
export declare enum DataTrackPacketizerReason {
|
|
22
22
|
MtuTooShort = 0
|
|
23
23
|
}
|
|
24
|
-
/** A packetizer takes a {@link
|
|
24
|
+
/** A packetizer takes a {@link DataTrackFrameInternal} as input and generates a series
|
|
25
25
|
* of {@link DataTrackPacket}s for transmission to other clients over webrtc. */
|
|
26
26
|
export default class DataTrackPacketizer {
|
|
27
27
|
private handle;
|
|
@@ -32,12 +32,12 @@ export default class DataTrackPacketizer {
|
|
|
32
32
|
constructor(trackHandle: DataTrackHandle, mtuSizeBytes: number);
|
|
33
33
|
/** @internal */
|
|
34
34
|
static computeFrameMarker(index: number, packetCount: number): FrameMarker;
|
|
35
|
-
/** Generates a series of packets for the specified {@link
|
|
35
|
+
/** Generates a series of packets for the specified {@link DataTrackFrameInternal}.
|
|
36
36
|
*
|
|
37
37
|
* NOTE: The return value of this function is a generator, so it can be lazily ran if desired,
|
|
38
38
|
* or converted to an array with {@link Array.from}.
|
|
39
39
|
*/
|
|
40
|
-
packetize(frame:
|
|
40
|
+
packetize(frame: DataTrackFrameInternal, options?: PacketizeOptions): Throws<Generator<DataTrackPacket>, DataTrackPacketizerError>;
|
|
41
41
|
}
|
|
42
42
|
export {};
|
|
43
43
|
//# sourceMappingURL=packetizer.d.ts.map
|
|
@@ -17,7 +17,7 @@ export declare const DataTrackSymbol: symbol;
|
|
|
17
17
|
/** An interface representing a data track, either local or remote. */
|
|
18
18
|
export interface IDataTrack extends ITrack {
|
|
19
19
|
readonly typeSymbol: typeof DataTrackSymbol;
|
|
20
|
-
readonly info
|
|
20
|
+
readonly info?: DataTrackInfo;
|
|
21
21
|
}
|
|
22
22
|
export declare function isDataTrack(subject: unknown): subject is IDataTrack;
|
|
23
23
|
//# sourceMappingURL=track-interfaces.d.ts.map
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import { DataTrackInfo as ProtocolDataTrackInfo } from '@livekit/protocol';
|
|
1
2
|
import type { DataTrackHandle } from './handle';
|
|
2
3
|
export type DataTrackSid = string;
|
|
3
4
|
/** Information about a published data track. */
|
|
4
5
|
export type DataTrackInfo = {
|
|
5
6
|
sid: DataTrackSid;
|
|
6
7
|
pubHandle: DataTrackHandle;
|
|
7
|
-
name:
|
|
8
|
+
name: string;
|
|
8
9
|
usesE2ee: boolean;
|
|
9
10
|
};
|
|
11
|
+
export declare const DataTrackInfo: {
|
|
12
|
+
from(protocolInfo: ProtocolDataTrackInfo): DataTrackInfo;
|
|
13
|
+
toProtobuf(info: DataTrackInfo): ProtocolDataTrackInfo;
|
|
14
|
+
};
|
|
10
15
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -291,7 +291,7 @@ export declare enum RoomEvent {
|
|
|
291
291
|
EncryptionError = "encryptionError",
|
|
292
292
|
/**
|
|
293
293
|
* Emits whenever the current buffer status of a data channel changes
|
|
294
|
-
* args: (isLow: boolean, kind: [[
|
|
294
|
+
* args: (isLow: boolean, kind: [[DataChannelKind]])
|
|
295
295
|
*/
|
|
296
296
|
DCBufferStatusChanged = "dcBufferStatusChanged",
|
|
297
297
|
/**
|
|
@@ -307,7 +307,23 @@ export declare enum RoomEvent {
|
|
|
307
307
|
/**
|
|
308
308
|
* fired when the client receives connection metrics from other participants
|
|
309
309
|
*/
|
|
310
|
-
MetricsReceived = "metricsReceived"
|
|
310
|
+
MetricsReceived = "metricsReceived",
|
|
311
|
+
/**
|
|
312
|
+
* Emits when a new data track has been published by a downstream participant.
|
|
313
|
+
*/
|
|
314
|
+
DataTrackPublished = "dataTrackPublished",
|
|
315
|
+
/**
|
|
316
|
+
* Emits when a new data track has been unpublished by a downstream participant.
|
|
317
|
+
*/
|
|
318
|
+
DataTrackUnpublished = "dataTrackUnpublished",
|
|
319
|
+
/**
|
|
320
|
+
* Emits when a new data track has been published locally.
|
|
321
|
+
*/
|
|
322
|
+
LocalDataTrackPublished = "localDataTrackPublished",
|
|
323
|
+
/**
|
|
324
|
+
* Emits when a new data track has been unpublished locally.
|
|
325
|
+
*/
|
|
326
|
+
LocalDataTrackUnpublished = "localDataTrackUnpublished"
|
|
311
327
|
}
|
|
312
328
|
export declare enum ParticipantEvent {
|
|
313
329
|
/**
|
|
@@ -528,7 +544,12 @@ export declare enum EngineEvent {
|
|
|
528
544
|
Offline = "offline",
|
|
529
545
|
SignalRequestResponse = "signalRequestResponse",
|
|
530
546
|
SignalConnected = "signalConnected",
|
|
531
|
-
RoomMoved = "roomMoved"
|
|
547
|
+
RoomMoved = "roomMoved",
|
|
548
|
+
PublishDataTrackResponse = "publishDataTrackResponse",
|
|
549
|
+
UnPublishDataTrackResponse = "unPublishDataTrackResponse",
|
|
550
|
+
DataTrackSubscriberHandles = "dataTrackSubscriberHandles",
|
|
551
|
+
DataTrackPacketReceived = "dataTrackPacketReceived",
|
|
552
|
+
Joined = "joined"
|
|
532
553
|
}
|
|
533
554
|
export declare enum TrackEvent {
|
|
534
555
|
Message = "message",
|
|
@@ -4,6 +4,9 @@ import TypedPromise from '../../utils/TypedPromise';
|
|
|
4
4
|
import type RTCEngine from '../RTCEngine';
|
|
5
5
|
import type OutgoingDataStreamManager from '../data-stream/outgoing/OutgoingDataStreamManager';
|
|
6
6
|
import type { TextStreamWriter } from '../data-stream/outgoing/StreamWriter';
|
|
7
|
+
import LocalDataTrack from '../data-track/LocalDataTrack';
|
|
8
|
+
import type OutgoingDataTrackManager from '../data-track/outgoing/OutgoingDataTrackManager';
|
|
9
|
+
import type { DataTrackOptions } from '../data-track/outgoing/types';
|
|
7
10
|
import type { PerformRpcParams, RpcInvocationData } from '../rpc';
|
|
8
11
|
import { RpcError } from '../rpc';
|
|
9
12
|
import LocalTrack from '../track/LocalTrack';
|
|
@@ -32,18 +35,20 @@ export default class LocalParticipant extends Participant {
|
|
|
32
35
|
private allParticipantsAllowedToSubscribe;
|
|
33
36
|
private roomOptions;
|
|
34
37
|
private encryptionType;
|
|
38
|
+
private e2eeStateMutex;
|
|
35
39
|
private reconnectFuture?;
|
|
36
40
|
private signalConnectedFuture?;
|
|
37
41
|
private activeAgentFuture?;
|
|
38
42
|
private firstActiveAgent?;
|
|
39
43
|
private rpcHandlers;
|
|
40
44
|
private roomOutgoingDataStreamManager;
|
|
45
|
+
private roomOutgoingDataTrackManager;
|
|
41
46
|
private pendingSignalRequests;
|
|
42
47
|
private enabledPublishVideoCodecs;
|
|
43
48
|
private pendingAcks;
|
|
44
49
|
private pendingResponses;
|
|
45
50
|
/** @internal */
|
|
46
|
-
constructor(sid: string, identity: string, engine: RTCEngine, options: InternalRoomOptions, roomRpcHandlers: Map<string, (data: RpcInvocationData) => Promise<string>>, roomOutgoingDataStreamManager: OutgoingDataStreamManager);
|
|
51
|
+
constructor(sid: string, identity: string, engine: RTCEngine, options: InternalRoomOptions, roomRpcHandlers: Map<string, (data: RpcInvocationData) => Promise<string>>, roomOutgoingDataStreamManager: OutgoingDataStreamManager, roomOutgoingDataTrackManager: OutgoingDataTrackManager);
|
|
47
52
|
get lastCameraError(): Error | undefined;
|
|
48
53
|
get lastMicrophoneError(): Error | undefined;
|
|
49
54
|
get isE2EEEnabled(): boolean;
|
|
@@ -261,5 +266,11 @@ export default class LocalParticipant extends Participant {
|
|
|
261
266
|
private handleTrackEnded;
|
|
262
267
|
private getPublicationForTrack;
|
|
263
268
|
private waitForPendingPublicationOfSource;
|
|
269
|
+
/** Publishes a data track.
|
|
270
|
+
*
|
|
271
|
+
* Returns the published data track if successful. Use {@link LocalDataTrack#tryPush}
|
|
272
|
+
* to send data frames on the track.
|
|
273
|
+
*/
|
|
274
|
+
publishDataTrack(options: DataTrackOptions): Promise<LocalDataTrack>;
|
|
264
275
|
}
|
|
265
276
|
//# sourceMappingURL=LocalParticipant.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ParticipantInfo } from '@livekit/protocol';
|
|
2
2
|
import type { SignalClient } from '../../api/SignalClient';
|
|
3
|
+
import { DeferrableMap } from '../../utils/deferrable-map';
|
|
4
|
+
import type RemoteDataTrack from '../data-track/RemoteDataTrack';
|
|
3
5
|
import RemoteTrackPublication from '../track/RemoteTrackPublication';
|
|
4
6
|
import { Track } from '../track/Track';
|
|
5
7
|
import type { AudioOutputOptions } from '../track/options';
|
|
@@ -11,6 +13,13 @@ export default class RemoteParticipant extends Participant {
|
|
|
11
13
|
audioTrackPublications: Map<string, RemoteTrackPublication>;
|
|
12
14
|
videoTrackPublications: Map<string, RemoteTrackPublication>;
|
|
13
15
|
trackPublications: Map<string, RemoteTrackPublication>;
|
|
16
|
+
/** A map of data track name to the corresponding {@link RemoteDataTrack}.
|
|
17
|
+
* @example
|
|
18
|
+
* // An already existing data track:
|
|
19
|
+
* const track = remoteParticipant.dataTracks.get("data track name");
|
|
20
|
+
* // Wait for a data track which will be published soon:
|
|
21
|
+
* const track = await remoteParticipant.dataTracks.getDeferred("data track name"); */
|
|
22
|
+
dataTracks: DeferrableMap<RemoteDataTrack['info']['name'], RemoteDataTrack>;
|
|
14
23
|
signalClient: SignalClient;
|
|
15
24
|
private volumeMap;
|
|
16
25
|
private audioOutput?;
|
|
@@ -53,6 +62,10 @@ export default class RemoteParticipant extends Participant {
|
|
|
53
62
|
*/
|
|
54
63
|
setAudioOutput(output: AudioOutputOptions): Promise<void>;
|
|
55
64
|
/** @internal */
|
|
65
|
+
addRemoteDataTrack(remoteDataTrack: RemoteDataTrack): void;
|
|
66
|
+
/** @internal */
|
|
67
|
+
removeRemoteDataTrack(remoteDataTrackSid: RemoteDataTrack['info']['sid']): void;
|
|
68
|
+
/** @internal */
|
|
56
69
|
emit<E extends keyof ParticipantEventCallbacks>(event: E, ...args: Parameters<ParticipantEventCallbacks[E]>): boolean;
|
|
57
70
|
}
|
|
58
71
|
//# sourceMappingURL=RemoteParticipant.d.ts.map
|
|
@@ -145,4 +145,5 @@ export declare function isLocalParticipant(p: Participant): p is LocalParticipan
|
|
|
145
145
|
export declare function isRemoteParticipant(p: Participant): p is RemoteParticipant;
|
|
146
146
|
export declare function splitUtf8(s: string, n: number): Uint8Array[];
|
|
147
147
|
export declare function extractMaxAgeFromRequestHeaders(headers: Headers): number | undefined;
|
|
148
|
+
export declare function isCompressionStreamSupported(): boolean;
|
|
148
149
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
+
/** An error which is thrown if a {@link DeferrableMap#getDeferred} call is aborted midway
|
|
3
|
+
* through. */
|
|
4
|
+
export declare class DeferrableMapAbortError extends DOMException {
|
|
5
|
+
reason: unknown;
|
|
6
|
+
constructor(message: string, reason?: unknown);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A Map-like container keyed by unique strings that supports the ability to wait
|
|
10
|
+
* for future keys to show up in the map.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // An already existing key:
|
|
14
|
+
* const value = map.get("key");
|
|
15
|
+
* // Wait for a key which will be added soon:
|
|
16
|
+
* const value = await map.getDeferred("key");
|
|
17
|
+
*/
|
|
18
|
+
export declare class DeferrableMap<K, V> extends Map<K, V> {
|
|
19
|
+
private pending;
|
|
20
|
+
set(key: K, value: V): this;
|
|
21
|
+
get [Symbol.toStringTag](): string;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the value for `key` immediately if it exists, otherwise returns a
|
|
24
|
+
* promise that resolves once `set(key, value)` is called.
|
|
25
|
+
*
|
|
26
|
+
* If an `AbortSignal` is provided and it is aborted before the key appears,
|
|
27
|
+
* the returned promise rejects with an {@link DeferrableMapAbortError}.
|
|
28
|
+
*/
|
|
29
|
+
getDeferred(key: K): Promise<V>;
|
|
30
|
+
getDeferred(key: K, signal: AbortSignal): Promise<Throws<V, DeferrableMapAbortError>>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=deferrable-map.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
declare const SerializerSymbol: unique symbol;
|
|
2
|
+
/**
|
|
3
|
+
* A bidirectional data format descriptor for message payloads.
|
|
4
|
+
*
|
|
5
|
+
* - `parse(raw)` decodes an incoming wire string into `Input` (used by handlers)
|
|
6
|
+
* - `serialize(val)` encodes an `Output` value to a wire string (used by handlers)
|
|
7
|
+
*
|
|
8
|
+
* For symmetric serializers (`serializers.raw`), `Input === Output === string`.
|
|
9
|
+
* For `serializers.json`, both default to `any` so each handler can annotate its own types.
|
|
10
|
+
* Use `serializers.custom` to supply your own `parse`/`serialize` pair.
|
|
11
|
+
*
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export type Serializer<Input, Output> = {
|
|
15
|
+
symbol: typeof SerializerSymbol;
|
|
16
|
+
parse: (raw: string) => Input;
|
|
17
|
+
serialize: (val: Output) => string;
|
|
18
|
+
};
|
|
19
|
+
export declare function isSerializer(v: unknown): v is Serializer<any, any>;
|
|
20
|
+
export type SerializerInput<S> = S extends Serializer<infer Input, any> ? Input : any;
|
|
21
|
+
export type SerializerOutput<S> = S extends Serializer<any, infer Output> ? Output : any;
|
|
22
|
+
/**
|
|
23
|
+
* JSON serializer — `JSON.parse` on the way in, `JSON.stringify` on the way out.
|
|
24
|
+
* Defaults to `any` so individual handlers can annotate their own payload types.
|
|
25
|
+
*/
|
|
26
|
+
declare function json<Input = any, Output = any>(): Serializer<Input, Output>;
|
|
27
|
+
/** Raw string serializer — passes payloads through as plain strings with no encoding. */
|
|
28
|
+
declare function raw(): Serializer<string, string>;
|
|
29
|
+
/** Custom serializer - allows custom defined parse and serialize functions */
|
|
30
|
+
declare function custom<Input = any, Output = any>(params: Omit<Serializer<Input, Output>, 'symbol'>): Serializer<Input, Output>;
|
|
31
|
+
/**
|
|
32
|
+
* Serializer helpers for message payload encoding.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const a = serializers.raw(); // Serializer<string, string>
|
|
37
|
+
* const b = serializer.json<{ foo: string }, { bar: string }>(); // Serializer<{ foo: string }, { bar: string }>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @beta
|
|
41
|
+
*/
|
|
42
|
+
export declare const serializers: {
|
|
43
|
+
json: typeof json;
|
|
44
|
+
raw: typeof raw;
|
|
45
|
+
custom: typeof custom;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=serializer.d.ts.map
|
package/package.json
CHANGED
|
@@ -300,8 +300,10 @@ describe('SignalClient.connect', () => {
|
|
|
300
300
|
|
|
301
301
|
describe('Failure Case - WebSocket Connection Errors', () => {
|
|
302
302
|
it('should reject with NotAllowed error for 4xx HTTP status', async () => {
|
|
303
|
+
const openedPromise = Promise.reject(new Error('Connection failed'));
|
|
304
|
+
openedPromise.catch(() => {}); // prevent unhandled rejection before join attaches its handler
|
|
303
305
|
mockWebSocketStream({
|
|
304
|
-
opened:
|
|
306
|
+
opened: openedPromise,
|
|
305
307
|
readyState: 3,
|
|
306
308
|
});
|
|
307
309
|
|
|
@@ -321,8 +323,10 @@ describe('SignalClient.connect', () => {
|
|
|
321
323
|
});
|
|
322
324
|
|
|
323
325
|
it('should reject with ServerUnreachable when fetch fails', async () => {
|
|
326
|
+
const openedPromise = Promise.reject(new Error('Connection failed'));
|
|
327
|
+
openedPromise.catch(() => {}); // prevent unhandled rejection before join attaches its handler
|
|
324
328
|
mockWebSocketStream({
|
|
325
|
-
opened:
|
|
329
|
+
opened: openedPromise,
|
|
326
330
|
readyState: 3,
|
|
327
331
|
});
|
|
328
332
|
|
|
@@ -338,9 +342,10 @@ describe('SignalClient.connect', () => {
|
|
|
338
342
|
|
|
339
343
|
it('should handle ConnectionError from WebSocket rejection', async () => {
|
|
340
344
|
const customError = ConnectionError.internal('Custom error', { status: 500 });
|
|
341
|
-
|
|
345
|
+
const openedPromise = Promise.reject(customError);
|
|
346
|
+
openedPromise.catch(() => {}); // prevent unhandled rejection before join attaches its handler
|
|
342
347
|
mockWebSocketStream({
|
|
343
|
-
opened:
|
|
348
|
+
opened: openedPromise,
|
|
344
349
|
readyState: 3,
|
|
345
350
|
});
|
|
346
351
|
|
package/src/api/SignalClient.ts
CHANGED
|
@@ -5,7 +5,9 @@ import {
|
|
|
5
5
|
ClientInfo,
|
|
6
6
|
ConnectionQualityUpdate,
|
|
7
7
|
ConnectionSettings,
|
|
8
|
+
DataTrackSubscriberHandles,
|
|
8
9
|
DisconnectReason,
|
|
10
|
+
Encryption_Type,
|
|
9
11
|
JoinRequest,
|
|
10
12
|
JoinResponse,
|
|
11
13
|
LeaveRequest,
|
|
@@ -14,6 +16,8 @@ import {
|
|
|
14
16
|
MuteTrackRequest,
|
|
15
17
|
ParticipantInfo,
|
|
16
18
|
Ping,
|
|
19
|
+
PublishDataTrackRequest,
|
|
20
|
+
PublishDataTrackResponse,
|
|
17
21
|
ReconnectReason,
|
|
18
22
|
ReconnectResponse,
|
|
19
23
|
RequestResponse,
|
|
@@ -35,6 +39,10 @@ import {
|
|
|
35
39
|
TrackPublishedResponse,
|
|
36
40
|
TrackUnpublishedResponse,
|
|
37
41
|
TrickleRequest,
|
|
42
|
+
UnpublishDataTrackRequest,
|
|
43
|
+
UnpublishDataTrackResponse,
|
|
44
|
+
UpdateDataSubscription,
|
|
45
|
+
UpdateDataSubscription_Update,
|
|
38
46
|
UpdateLocalAudioTrack,
|
|
39
47
|
UpdateParticipantMetadata,
|
|
40
48
|
UpdateSubscription,
|
|
@@ -42,13 +50,16 @@ import {
|
|
|
42
50
|
UpdateVideoLayers,
|
|
43
51
|
VideoLayer,
|
|
44
52
|
WrappedJoinRequest,
|
|
53
|
+
WrappedJoinRequest_Compression,
|
|
45
54
|
protoInt64,
|
|
46
55
|
} from '@livekit/protocol';
|
|
47
56
|
import log, { LoggerNames, getLogger } from '../logger';
|
|
57
|
+
import type { DataTrackHandle } from '../room/data-track/handle';
|
|
58
|
+
import { type DataTrackSid } from '../room/data-track/types';
|
|
48
59
|
import { ConnectionError } from '../room/errors';
|
|
49
60
|
import CriticalTimers from '../room/timers';
|
|
50
61
|
import type { LoggerOptions } from '../room/types';
|
|
51
|
-
import { getClientInfo, isReactNative, sleep } from '../room/utils';
|
|
62
|
+
import { getClientInfo, isCompressionStreamSupported, isReactNative, sleep } from '../room/utils';
|
|
52
63
|
import { AsyncQueue } from '../utils/AsyncQueue';
|
|
53
64
|
import { type WebSocketConnection, WebSocketStream } from './WebSocketStream';
|
|
54
65
|
import {
|
|
@@ -174,6 +185,14 @@ export class SignalClient {
|
|
|
174
185
|
|
|
175
186
|
onMediaSectionsRequirement?: (requirement: MediaSectionsRequirement) => void;
|
|
176
187
|
|
|
188
|
+
onPublishDataTrackResponse?: (event: PublishDataTrackResponse) => void;
|
|
189
|
+
|
|
190
|
+
onUnPublishDataTrackResponse?: (event: UnpublishDataTrackResponse) => void;
|
|
191
|
+
|
|
192
|
+
onDataTrackSubscriberHandles?: (event: DataTrackSubscriberHandles) => void;
|
|
193
|
+
|
|
194
|
+
onJoined?: (event: JoinResponse) => void;
|
|
195
|
+
|
|
177
196
|
connectOptions?: ConnectOpts;
|
|
178
197
|
|
|
179
198
|
ws?: WebSocketStream;
|
|
@@ -248,12 +267,13 @@ export class SignalClient {
|
|
|
248
267
|
opts: SignalOptions,
|
|
249
268
|
abortSignal?: AbortSignal,
|
|
250
269
|
useV0Path: boolean = false,
|
|
270
|
+
publisherOffer?: SessionDescription,
|
|
251
271
|
): Promise<JoinResponse> {
|
|
252
272
|
// during a full reconnect, we'd want to start the sequence even if currently
|
|
253
273
|
// connected
|
|
254
274
|
this.state = SignalConnectionState.CONNECTING;
|
|
255
275
|
this.options = opts;
|
|
256
|
-
const res = await this.connect(url, token, opts, abortSignal, useV0Path);
|
|
276
|
+
const res = await this.connect(url, token, opts, abortSignal, useV0Path, publisherOffer);
|
|
257
277
|
return res as JoinResponse;
|
|
258
278
|
}
|
|
259
279
|
|
|
@@ -296,6 +316,7 @@ export class SignalClient {
|
|
|
296
316
|
abortSignal?: AbortSignal,
|
|
297
317
|
/** setting this to true results in dual peer connection mode being used */
|
|
298
318
|
useV0Path: boolean = false,
|
|
319
|
+
publisherOffer?: SessionDescription,
|
|
299
320
|
): Promise<JoinResponse | ReconnectResponse | undefined> {
|
|
300
321
|
const unlock = await this.connectionLock.lock();
|
|
301
322
|
|
|
@@ -305,7 +326,7 @@ export class SignalClient {
|
|
|
305
326
|
const clientInfo = getClientInfo();
|
|
306
327
|
const params = useV0Path
|
|
307
328
|
? createConnectionParams(token, clientInfo, opts)
|
|
308
|
-
: createJoinRequestConnectionParams(token, clientInfo, opts);
|
|
329
|
+
: await createJoinRequestConnectionParams(token, clientInfo, opts, publisherOffer);
|
|
309
330
|
const rtcUrl = createRtcUrl(url, params, useV0Path).toString();
|
|
310
331
|
const validateUrl = createValidateUrl(rtcUrl).toString();
|
|
311
332
|
|
|
@@ -437,8 +458,9 @@ export class SignalClient {
|
|
|
437
458
|
return;
|
|
438
459
|
}
|
|
439
460
|
|
|
440
|
-
// Handle join response
|
|
461
|
+
// Handle join response
|
|
441
462
|
if (firstSignalResponse.message?.case === 'join') {
|
|
463
|
+
// Set up ping configuration
|
|
442
464
|
this.pingTimeoutDuration = firstSignalResponse.message.value.pingTimeout;
|
|
443
465
|
this.pingIntervalDuration = firstSignalResponse.message.value.pingInterval;
|
|
444
466
|
|
|
@@ -449,6 +471,10 @@ export class SignalClient {
|
|
|
449
471
|
interval: this.pingIntervalDuration,
|
|
450
472
|
});
|
|
451
473
|
}
|
|
474
|
+
|
|
475
|
+
if (this.onJoined) {
|
|
476
|
+
this.onJoined(firstSignalResponse.message.value);
|
|
477
|
+
}
|
|
452
478
|
}
|
|
453
479
|
|
|
454
480
|
// Handle successful connection
|
|
@@ -685,7 +711,40 @@ export class SignalClient {
|
|
|
685
711
|
});
|
|
686
712
|
}
|
|
687
713
|
|
|
688
|
-
|
|
714
|
+
sendPublishDataTrackRequest(handle: DataTrackHandle, name: string, usesE2ee: boolean) {
|
|
715
|
+
return this.sendRequest({
|
|
716
|
+
case: 'publishDataTrackRequest',
|
|
717
|
+
value: new PublishDataTrackRequest({
|
|
718
|
+
pubHandle: handle,
|
|
719
|
+
name: name,
|
|
720
|
+
encryption: usesE2ee ? Encryption_Type.GCM : Encryption_Type.NONE,
|
|
721
|
+
}),
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
sendUnPublishDataTrackRequest(handle: DataTrackHandle) {
|
|
726
|
+
return this.sendRequest({
|
|
727
|
+
case: 'unpublishDataTrackRequest',
|
|
728
|
+
value: new UnpublishDataTrackRequest({ pubHandle: handle }),
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
sendUpdateDataSubscription(sid: DataTrackSid, subscribe: boolean) {
|
|
733
|
+
return this.sendRequest({
|
|
734
|
+
case: 'updateDataSubscription',
|
|
735
|
+
value: new UpdateDataSubscription({
|
|
736
|
+
// FIXME: consider refactoring to allow caller to pass an array of events through
|
|
737
|
+
updates: [
|
|
738
|
+
new UpdateDataSubscription_Update({
|
|
739
|
+
trackSid: sid,
|
|
740
|
+
subscribe,
|
|
741
|
+
}),
|
|
742
|
+
],
|
|
743
|
+
}),
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
private async sendRequest(message: SignalMessage, fromQueue: boolean = false) {
|
|
689
748
|
// capture all requests while reconnecting and put them in a queue
|
|
690
749
|
// unless the request originates from the queue, then don't enqueue again
|
|
691
750
|
const canQueue = !fromQueue && !canPassThroughQueue(message);
|
|
@@ -827,6 +886,18 @@ export class SignalClient {
|
|
|
827
886
|
if (this.onMediaSectionsRequirement) {
|
|
828
887
|
this.onMediaSectionsRequirement(msg.value);
|
|
829
888
|
}
|
|
889
|
+
} else if (msg.case === 'publishDataTrackResponse') {
|
|
890
|
+
if (this.onPublishDataTrackResponse) {
|
|
891
|
+
this.onPublishDataTrackResponse(msg.value);
|
|
892
|
+
}
|
|
893
|
+
} else if (msg.case === 'unpublishDataTrackResponse') {
|
|
894
|
+
if (this.onUnPublishDataTrackResponse) {
|
|
895
|
+
this.onUnPublishDataTrackResponse(msg.value);
|
|
896
|
+
}
|
|
897
|
+
} else if (msg.case === 'dataTrackSubscriberHandles') {
|
|
898
|
+
if (this.onDataTrackSubscriberHandles) {
|
|
899
|
+
this.onDataTrackSubscriberHandles(msg.value);
|
|
900
|
+
}
|
|
830
901
|
} else {
|
|
831
902
|
this.log.debug('unsupported message', { ...this.logContext, msgCase: msg.case });
|
|
832
903
|
}
|
|
@@ -1125,11 +1196,12 @@ function createConnectionParams(
|
|
|
1125
1196
|
return params;
|
|
1126
1197
|
}
|
|
1127
1198
|
|
|
1128
|
-
function createJoinRequestConnectionParams(
|
|
1199
|
+
async function createJoinRequestConnectionParams(
|
|
1129
1200
|
token: string,
|
|
1130
1201
|
info: ClientInfo,
|
|
1131
1202
|
opts: ConnectOpts,
|
|
1132
|
-
|
|
1203
|
+
publisherOffer?: SessionDescription,
|
|
1204
|
+
): Promise<URLSearchParams> {
|
|
1133
1205
|
const params = new URLSearchParams();
|
|
1134
1206
|
params.set('access_token', token);
|
|
1135
1207
|
|
|
@@ -1141,14 +1213,49 @@ function createJoinRequestConnectionParams(
|
|
|
1141
1213
|
}),
|
|
1142
1214
|
reconnect: !!opts.reconnect,
|
|
1143
1215
|
participantSid: opts.sid ? opts.sid : undefined,
|
|
1216
|
+
publisherOffer: publisherOffer,
|
|
1144
1217
|
});
|
|
1145
1218
|
if (opts.reconnectReason) {
|
|
1146
1219
|
joinRequest.reconnectReason = opts.reconnectReason;
|
|
1147
1220
|
}
|
|
1221
|
+
const joinRequestBytes = joinRequest.toBinary();
|
|
1222
|
+
let requestBytes: Uint8Array;
|
|
1223
|
+
let compression: WrappedJoinRequest_Compression;
|
|
1224
|
+
if (isCompressionStreamSupported()) {
|
|
1225
|
+
const stream = new CompressionStream('gzip');
|
|
1226
|
+
const writer = stream.writable.getWriter();
|
|
1227
|
+
writer.write(new Uint8Array(joinRequestBytes));
|
|
1228
|
+
writer.close();
|
|
1229
|
+
const chunks: Uint8Array[] = [];
|
|
1230
|
+
const reader = stream.readable.getReader();
|
|
1231
|
+
while (true) {
|
|
1232
|
+
const { done, value } = await reader.read();
|
|
1233
|
+
if (done) break;
|
|
1234
|
+
chunks.push(value);
|
|
1235
|
+
}
|
|
1236
|
+
const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
1237
|
+
const result = new Uint8Array(totalLength);
|
|
1238
|
+
let offset = 0;
|
|
1239
|
+
for (const chunk of chunks) {
|
|
1240
|
+
result.set(chunk, offset);
|
|
1241
|
+
offset += chunk.length;
|
|
1242
|
+
}
|
|
1243
|
+
requestBytes = result;
|
|
1244
|
+
compression = WrappedJoinRequest_Compression.GZIP;
|
|
1245
|
+
} else {
|
|
1246
|
+
requestBytes = joinRequestBytes;
|
|
1247
|
+
compression = WrappedJoinRequest_Compression.NONE;
|
|
1248
|
+
}
|
|
1148
1249
|
const wrappedJoinRequest = new WrappedJoinRequest({
|
|
1149
|
-
joinRequest:
|
|
1250
|
+
joinRequest: requestBytes,
|
|
1251
|
+
compression,
|
|
1150
1252
|
});
|
|
1151
|
-
|
|
1253
|
+
const wrappedBytes = wrappedJoinRequest.toBinary();
|
|
1254
|
+
const bytesToBase64 = (bytes: Uint8Array) => {
|
|
1255
|
+
const binString = Array.from(bytes, (byte) => String.fromCodePoint(byte)).join('');
|
|
1256
|
+
return btoa(binString);
|
|
1257
|
+
};
|
|
1258
|
+
params.set('join_request', bytesToBase64(wrappedBytes).replace(/\+/g, '-').replace(/\//g, '_'));
|
|
1152
1259
|
|
|
1153
1260
|
return params;
|
|
1154
1261
|
}
|
|
@@ -11,7 +11,7 @@ import { TURNCheck } from './checks/turn';
|
|
|
11
11
|
import { WebRTCCheck } from './checks/webrtc';
|
|
12
12
|
import { WebSocketCheck } from './checks/websocket';
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export { type CheckInfo, CheckStatus };
|
|
15
15
|
|
|
16
16
|
export class ConnectionCheck extends (EventEmitter as new () => TypedEmitter<ConnectionCheckCallbacks>) {
|
|
17
17
|
token: string;
|
package/src/e2ee/constants.ts
CHANGED
package/src/e2ee/types.ts
CHANGED
|
@@ -183,6 +183,12 @@ export type KeyProviderOptions = {
|
|
|
183
183
|
ratchetWindowSize: number;
|
|
184
184
|
failureTolerance: number;
|
|
185
185
|
keyringSize: number;
|
|
186
|
+
/**
|
|
187
|
+
* Size of the encryption key in bits.
|
|
188
|
+
* Defaults to 128. Note that 128 is currently the only value
|
|
189
|
+
* supported by non-web SDKs.
|
|
190
|
+
*/
|
|
191
|
+
keySize: 128 | 256;
|
|
186
192
|
};
|
|
187
193
|
|
|
188
194
|
export type KeyInfo = {
|