livekit-client 2.24.0 → 2.24.1
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/README.md +3 -4
- package/dist/core/api/SignalClient.mjs +3 -1
- package/dist/core/api/SignalClient.mjs.map +1 -1
- package/dist/core/e2ee/E2eeManager.mjs +7 -10
- package/dist/core/e2ee/E2eeManager.mjs.map +1 -1
- package/dist/core/package.json.mjs +1 -1
- package/dist/core/room/rpc/client/RpcClientManager.mjs +18 -0
- package/dist/core/room/rpc/client/RpcClientManager.mjs.map +1 -1
- package/dist/core/room/rpc/extension.mjs +1 -0
- package/dist/core/room/rpc/extension.mjs.map +1 -1
- package/dist/core/room/rpc/utils.mjs +2 -0
- package/dist/core/room/rpc/utils.mjs.map +1 -1
- package/dist/core/room/utils.mjs +4 -1
- package/dist/core/room/utils.mjs.map +1 -1
- package/dist/core/ts4.2/e2ee/E2eeManager.d.ts +1 -0
- package/dist/core/ts4.2/room/rpc/extension.d.ts +3 -3
- package/dist/core/ts4.2/room/rpc/utils.d.ts +1 -0
- package/dist/core/types/src/e2ee/E2eeManager.d.ts +1 -0
- package/dist/core/types/src/room/rpc/extension.d.ts +3 -3
- package/dist/core/types/src/room/rpc/utils.d.ts +1 -0
- 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 +6 -3
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +48 -21
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.fm.worker.js.map +1 -1
- package/dist/livekit-client.fm.worker.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.map +1 -1
- package/dist/src/e2ee/E2eeManager.d.ts +1 -0
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/room/rpc/client/RpcClientManager.d.ts +5 -0
- package/dist/src/room/rpc/client/RpcClientManager.d.ts.map +1 -1
- package/dist/src/room/rpc/extension.d.ts +3 -3
- package/dist/src/room/rpc/extension.d.ts.map +1 -1
- package/dist/src/room/rpc/legacyExtension.d.ts +1 -1
- package/dist/src/room/rpc/utils.d.ts +1 -0
- package/dist/src/room/rpc/utils.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/ts4.2/e2ee/E2eeManager.d.ts +1 -0
- package/dist/ts4.2/room/rpc/client/RpcClientManager.d.ts +5 -0
- package/dist/ts4.2/room/rpc/extension.d.ts +3 -3
- package/dist/ts4.2/room/rpc/legacyExtension.d.ts +1 -1
- package/dist/ts4.2/room/rpc/utils.d.ts +1 -0
- package/package.json +1 -1
- package/src/api/SignalClient.test.ts +43 -0
- package/src/api/SignalClient.ts +6 -1
- package/src/e2ee/E2eeManager.test.ts +86 -2
- package/src/e2ee/E2eeManager.ts +11 -9
- package/src/e2ee/worker/FrameCryptor.test.ts +26 -0
- package/src/e2ee/worker/FrameCryptor.ts +7 -4
- package/src/room/Room.test.ts +24 -0
- package/src/room/rpc/client/RpcClientManager.test.ts +29 -0
- package/src/room/rpc/client/RpcClientManager.ts +17 -0
- package/src/room/rpc/extension.ts +4 -1
- package/src/room/rpc/utils.ts +2 -0
- package/src/room/utils.test.ts +36 -1
- package/src/room/utils.ts +11 -1
|
@@ -12395,7 +12395,7 @@ function getMatch(exp, ua) {
|
|
|
12395
12395
|
}
|
|
12396
12396
|
function getOSVersion(ua) {
|
|
12397
12397
|
return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
|
|
12398
|
-
}var version$1 = "2.24.
|
|
12398
|
+
}var version$1 = "2.24.1";const version = version$1;
|
|
12399
12399
|
/** First server protocol version that creates the single peer connection data channels as
|
|
12400
12400
|
* negotiated (fixed SCTP stream IDs) instead of opening them in-band. */
|
|
12401
12401
|
const PROTOCOL_NEGOTIATED_DATA_CHANNELS = 18;
|
|
@@ -14692,7 +14692,7 @@ function getClientInfo(capabilities) {
|
|
|
14692
14692
|
var _a;
|
|
14693
14693
|
const info = new ClientInfo({
|
|
14694
14694
|
capabilities,
|
|
14695
|
-
sdk: ClientInfo_SDK.JS,
|
|
14695
|
+
sdk: isReactNative() ? ClientInfo_SDK.REACT_NATIVE : ClientInfo_SDK.JS,
|
|
14696
14696
|
protocol: protocolVersion,
|
|
14697
14697
|
clientProtocol,
|
|
14698
14698
|
version
|
|
@@ -15711,7 +15711,14 @@ function announceMachine(label, machine) {
|
|
|
15711
15711
|
return;
|
|
15712
15712
|
}
|
|
15713
15713
|
}const _excluded = ["client"];
|
|
15714
|
-
|
|
15714
|
+
const __lkWeakRef = typeof WeakRef !== 'undefined' ? WeakRef : class {
|
|
15715
|
+
constructor(target) {
|
|
15716
|
+
this.target = target;
|
|
15717
|
+
}
|
|
15718
|
+
deref() {
|
|
15719
|
+
return this.target;
|
|
15720
|
+
}
|
|
15721
|
+
}; //#region src/emitter.ts
|
|
15715
15722
|
/**
|
|
15716
15723
|
* Minimal typed event emitter used internally by Fsm and BehavioralFsm.
|
|
15717
15724
|
*
|
|
@@ -16018,7 +16025,7 @@ var BehavioralFsm = class BehavioralFsm {
|
|
|
16018
16025
|
const meta = this.getOrCreateClientMeta(client);
|
|
16019
16026
|
const fromState = meta.state;
|
|
16020
16027
|
if (toState === fromState) return;
|
|
16021
|
-
if (!Object.
|
|
16028
|
+
if (!Object.prototype.hasOwnProperty.call(this.states, toState)) {
|
|
16022
16029
|
this.emitter.emit("invalidstate", {
|
|
16023
16030
|
stateName: toState,
|
|
16024
16031
|
client
|
|
@@ -16143,11 +16150,11 @@ var BehavioralFsm = class BehavioralFsm {
|
|
|
16143
16150
|
const state = snapshot.state,
|
|
16144
16151
|
deferred = snapshot.deferred,
|
|
16145
16152
|
children = snapshot.children;
|
|
16146
|
-
if (!Object.
|
|
16153
|
+
if (!Object.prototype.hasOwnProperty.call(this.states, state)) throw new Error("rehydrate: unknown state \"".concat(state, "\" in FSM \"").concat(this.id, "\". Valid states: ").concat(Object.keys(this.states).join(", ")));
|
|
16147
16154
|
const writes = [];
|
|
16148
16155
|
if (children) for (const stateName of Object.keys(children)) {
|
|
16149
16156
|
var _this$states$stateNam;
|
|
16150
|
-
if (!Object.
|
|
16157
|
+
if (!Object.prototype.hasOwnProperty.call(this.states, stateName)) throw new Error("rehydrate: unknown state \"".concat(stateName, "\" in FSM \"").concat(this.id, "\" referenced by snapshot.children."));
|
|
16151
16158
|
const childLink = (_this$states$stateNam = this.states[stateName]) === null || _this$states$stateNam === void 0 ? void 0 : _this$states$stateNam._child;
|
|
16152
16159
|
if (!childLink) throw new Error("rehydrate: state \"".concat(stateName, "\" in FSM \"").concat(this.id, "\" has no _child, but the snapshot has a children[\"").concat(stateName, "\"] entry."));
|
|
16153
16160
|
writes.push(...childLink.planRehydrate(client, children[stateName]));
|
|
@@ -16159,7 +16166,7 @@ var BehavioralFsm = class BehavioralFsm {
|
|
|
16159
16166
|
untilState: item.untilState
|
|
16160
16167
|
} : {}));
|
|
16161
16168
|
writes.push(() => {
|
|
16162
|
-
if (!this.clients.has(client)) this.knownClients.add(new
|
|
16169
|
+
if (!this.clients.has(client)) this.knownClients.add(new __lkWeakRef(client));
|
|
16163
16170
|
this.clients.set(client, {
|
|
16164
16171
|
state,
|
|
16165
16172
|
deferredQueue
|
|
@@ -16172,7 +16179,7 @@ var BehavioralFsm = class BehavioralFsm {
|
|
|
16172
16179
|
_compositeState$split2 = _toArray(_compositeState$split),
|
|
16173
16180
|
state = _compositeState$split2[0],
|
|
16174
16181
|
rest = _arrayLikeToArray(_compositeState$split2).slice(1);
|
|
16175
|
-
if (!Object.
|
|
16182
|
+
if (!Object.prototype.hasOwnProperty.call(this.states, state)) throw new Error("rehydrate: unknown state \"".concat(state, "\" in FSM \"").concat(this.id, "\". Valid states: ").concat(Object.keys(this.states).join(", ")));
|
|
16176
16183
|
if (rest.length > 0) {
|
|
16177
16184
|
var _this$states$state;
|
|
16178
16185
|
const childPath = rest.join(".");
|
|
@@ -16180,7 +16187,7 @@ var BehavioralFsm = class BehavioralFsm {
|
|
|
16180
16187
|
if (!childLink) throw new Error("rehydrate: state \"".concat(state, "\" in FSM \"").concat(this.id, "\" has no _child, but composite path \"").concat(compositeState, "\" requires one."));
|
|
16181
16188
|
childLink.rehydrate(client, childPath);
|
|
16182
16189
|
}
|
|
16183
|
-
if (!this.clients.has(client)) this.knownClients.add(new
|
|
16190
|
+
if (!this.clients.has(client)) this.knownClients.add(new __lkWeakRef(client));
|
|
16184
16191
|
this.clients.set(client, {
|
|
16185
16192
|
state,
|
|
16186
16193
|
deferredQueue: []
|
|
@@ -16443,7 +16450,7 @@ var BehavioralFsm = class BehavioralFsm {
|
|
|
16443
16450
|
deferredQueue: []
|
|
16444
16451
|
};
|
|
16445
16452
|
this.clients.set(client, meta);
|
|
16446
|
-
this.knownClients.add(new
|
|
16453
|
+
this.knownClients.add(new __lkWeakRef(client));
|
|
16447
16454
|
this.transition(client, this.initialState);
|
|
16448
16455
|
return meta;
|
|
16449
16456
|
}
|
|
@@ -17214,7 +17221,9 @@ class SignalClient {
|
|
|
17214
17221
|
return;
|
|
17215
17222
|
}
|
|
17216
17223
|
alreadyAborted = true;
|
|
17217
|
-
|
|
17224
|
+
// React Native has no global Event; `instanceof Event` throws ReferenceError there and
|
|
17225
|
+
// leaves the timeout/abort path unable to close the socket or reject the connect.
|
|
17226
|
+
const target = typeof Event !== 'undefined' && eventOrError instanceof Event ? eventOrError.currentTarget : eventOrError;
|
|
17218
17227
|
const reason = getAbortReasonAsString(target, 'Abort handler called');
|
|
17219
17228
|
// send leave if we have an active stream writer (connection is open)
|
|
17220
17229
|
if (this.streamWriter && !this.isDisconnected) {
|
|
@@ -32794,6 +32803,7 @@ RpcError.ErrorCode = {
|
|
|
32794
32803
|
RECIPIENT_DISCONNECTED: 1503,
|
|
32795
32804
|
RESPONSE_PAYLOAD_TOO_LARGE: 1504,
|
|
32796
32805
|
SEND_FAILED: 1505,
|
|
32806
|
+
CONNECTION_CLOSED: 1506,
|
|
32797
32807
|
UNSUPPORTED_METHOD: 1400,
|
|
32798
32808
|
RECIPIENT_NOT_FOUND: 1401,
|
|
32799
32809
|
REQUEST_PAYLOAD_TOO_LARGE: 1402,
|
|
@@ -32810,6 +32820,7 @@ RpcError.ErrorMessage = {
|
|
|
32810
32820
|
RECIPIENT_DISCONNECTED: 'Recipient disconnected',
|
|
32811
32821
|
RESPONSE_PAYLOAD_TOO_LARGE: 'Response payload too large',
|
|
32812
32822
|
SEND_FAILED: 'Failed to send',
|
|
32823
|
+
CONNECTION_CLOSED: 'Connection closed',
|
|
32813
32824
|
UNSUPPORTED_METHOD: 'Method not supported at destination',
|
|
32814
32825
|
RECIPIENT_NOT_FOUND: 'Recipient not found',
|
|
32815
32826
|
REQUEST_PAYLOAD_TOO_LARGE: 'Request payload too large',
|
|
@@ -33097,6 +33108,24 @@ class RpcClientManager extends eventsExports.EventEmitter {
|
|
|
33097
33108
|
}
|
|
33098
33109
|
}
|
|
33099
33110
|
}
|
|
33111
|
+
/**
|
|
33112
|
+
* No ack or response can arrive once the local participant has left the room.
|
|
33113
|
+
* @internal
|
|
33114
|
+
*/
|
|
33115
|
+
handleRoomDisconnected() {
|
|
33116
|
+
var _a;
|
|
33117
|
+
for (const _ref6 of this.pendingAcks.values()) {
|
|
33118
|
+
const resolve = _ref6.resolve;
|
|
33119
|
+
// clears the ack timer
|
|
33120
|
+
resolve();
|
|
33121
|
+
}
|
|
33122
|
+
this.pendingAcks.clear();
|
|
33123
|
+
for (const _ref7 of this.pendingResponses.values()) {
|
|
33124
|
+
const completionFuture = _ref7.completionFuture;
|
|
33125
|
+
(_a = completionFuture.reject) === null || _a === void 0 ? void 0 : _a.call(completionFuture, RpcError.builtIn('CONNECTION_CLOSED'));
|
|
33126
|
+
}
|
|
33127
|
+
this.pendingResponses.clear();
|
|
33128
|
+
}
|
|
33100
33129
|
}/**
|
|
33101
33130
|
* Manages the server (handler) side of RPC: processing incoming requests,
|
|
33102
33131
|
* managing registered method handlers, and sending responses.
|
|
@@ -36746,6 +36775,7 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
36746
36775
|
}
|
|
36747
36776
|
constructor(options, dcEncryptionEnabled) {
|
|
36748
36777
|
super();
|
|
36778
|
+
this.keysPostedToWorker = new WeakSet();
|
|
36749
36779
|
this.decryptDataRequests = new Map();
|
|
36750
36780
|
this.encryptDataRequests = new Map();
|
|
36751
36781
|
this.log = getLogger(LoggerNames.E2EE, () => this.logContext);
|
|
@@ -36782,11 +36812,6 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
36782
36812
|
}
|
|
36783
36813
|
break;
|
|
36784
36814
|
case 'enable':
|
|
36785
|
-
if (data.enabled) {
|
|
36786
|
-
this.keyProvider.getKeys().forEach(keyInfo => {
|
|
36787
|
-
this.postKey(keyInfo, false);
|
|
36788
|
-
});
|
|
36789
|
-
}
|
|
36790
36815
|
if (data.local) {
|
|
36791
36816
|
if (this.encryptionEnabled !== data.enabled) {
|
|
36792
36817
|
this.emit(EncryptionEvent.ParticipantEncryptionStatusChanged, data.enabled, this.room.localParticipant);
|
|
@@ -37015,7 +37040,7 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
37015
37040
|
throw new TypeError("expected room to be present on signal connect");
|
|
37016
37041
|
}
|
|
37017
37042
|
const latestKeyIndex = keyProvider.getLatestManuallySetKeyIndex();
|
|
37018
|
-
keyProvider.getKeys().forEach(keyInfo => {
|
|
37043
|
+
keyProvider.getKeys().filter(keyInfo => !this.keysPostedToWorker.has(keyInfo)).forEach(keyInfo => {
|
|
37019
37044
|
var _a;
|
|
37020
37045
|
this.postKey(keyInfo, latestKeyIndex === ((_a = keyInfo.keyIndex) !== null && _a !== void 0 ? _a : 0));
|
|
37021
37046
|
});
|
|
@@ -37102,14 +37127,14 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
37102
37127
|
};
|
|
37103
37128
|
this.worker.postMessage(msg);
|
|
37104
37129
|
}
|
|
37105
|
-
postKey(
|
|
37106
|
-
let key = _ref.key,
|
|
37107
|
-
participantIdentity = _ref.participantIdentity,
|
|
37108
|
-
keyIndex = _ref.keyIndex;
|
|
37130
|
+
postKey(keyInfo, updateCurrentKeyIndex) {
|
|
37109
37131
|
var _a;
|
|
37110
37132
|
if (!this.worker) {
|
|
37111
37133
|
throw Error('could not set key, worker is missing');
|
|
37112
37134
|
}
|
|
37135
|
+
const key = keyInfo.key,
|
|
37136
|
+
participantIdentity = keyInfo.participantIdentity,
|
|
37137
|
+
keyIndex = keyInfo.keyIndex;
|
|
37113
37138
|
const msg = {
|
|
37114
37139
|
kind: 'setKey',
|
|
37115
37140
|
data: {
|
|
@@ -37121,6 +37146,7 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
37121
37146
|
}
|
|
37122
37147
|
};
|
|
37123
37148
|
this.worker.postMessage(msg);
|
|
37149
|
+
this.keysPostedToWorker.add(keyInfo);
|
|
37124
37150
|
}
|
|
37125
37151
|
postEnable(enabled, participantIdentity) {
|
|
37126
37152
|
let local = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
@@ -38999,6 +39025,7 @@ const rpc = {
|
|
|
38999
39025
|
},
|
|
39000
39026
|
rpcAck: ack => client.handleIncomingRpcAck(ack.requestId)
|
|
39001
39027
|
},
|
|
39028
|
+
onDisconnect: () => client.handleRoomDisconnected(),
|
|
39002
39029
|
room: {
|
|
39003
39030
|
registerRpcMethod,
|
|
39004
39031
|
unregisterRpcMethod
|