@lakutata/webrtc 3.1.4 → 3.1.6
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 +2 -1
- package/README.zh-CN.md +1 -1
- package/dist/cjs/exceptions/SignalingConnectionException.d.ts +1 -1
- package/dist/cjs/exceptions/SignalingConnectionException.js +1 -1
- package/dist/cjs/lib/ice/dns/lookup.js +11 -3
- package/dist/cjs/lib/peer/peerConnection.d.ts +2 -0
- package/dist/cjs/lib/peer/peerConnection.js +4 -2
- package/dist/cjs/peer/PeerThreads.js +15 -2
- package/dist/cjs/peer/PeerWorkerCode.js +1 -1
- package/dist/cjs/peer/SignalingClient.d.ts +2 -1
- package/dist/cjs/peer/SignalingClient.js +22 -4
- package/dist/cjs/sfu/SFUWorkerCode.js +1 -1
- package/dist/cjs/sfu/SFUWorkers.js +3 -1
- package/dist/cjs/shared/SignalingSession.js +1 -0
- package/dist/cjs/shared/Transports.d.ts +1 -1
- package/dist/cjs/turn/TURNWorkers.js +3 -1
- package/dist/esm/exceptions/SignalingConnectionException.js +1 -1
- package/dist/esm/lib/ice/dns/lookup.js +11 -3
- package/dist/esm/lib/peer/peerConnection.js +4 -2
- package/dist/esm/peer/PeerThreads.js +12 -2
- package/dist/esm/peer/PeerWorkerCode.js +1 -1
- package/dist/esm/peer/SignalingClient.js +23 -5
- package/dist/esm/sfu/SFUWorkerCode.js +1 -1
- package/dist/esm/sfu/SFUWorkers.js +3 -1
- package/dist/esm/shared/SignalingSession.js +1 -0
- package/dist/esm/turn/TURNWorkers.js +3 -1
- package/dist/types/exceptions/SignalingConnectionException.d.ts +1 -1
- package/dist/types/lib/peer/peerConnection.d.ts +2 -0
- package/dist/types/peer/SignalingClient.d.ts +2 -1
- package/dist/types/shared/Transports.d.ts +1 -1
- package/package.json +9 -5
|
@@ -445,7 +445,9 @@ export class SFUWorkers {
|
|
|
445
445
|
//Running once it says so: a thread failing to start is not started again
|
|
446
446
|
slot.ran = false;
|
|
447
447
|
const resourceLimits = this.#host.resourceLimits;
|
|
448
|
-
|
|
448
|
+
//Without the options of the command line of the process, which a worker inherits: with --input-type=module, its code
|
|
449
|
+
//(CommonJS) would run as an ES module
|
|
450
|
+
const worker = new Worker(sfuWorkerCode, { eval: true, execArgv: [], workerData: this.#data[slot.index], ...resourceLimits ? { resourceLimits: resourceLimits } : {} });
|
|
449
451
|
slot.worker = worker;
|
|
450
452
|
slot.channel = new SFUWorkerChannel(worker, (message) => this.#handle(slot, message));
|
|
451
453
|
slot.ready = new Promise((resolve, reject) => {
|
|
@@ -18,6 +18,7 @@ const MAX_REJOIN_DELAY = 10000;
|
|
|
18
18
|
*/
|
|
19
19
|
function randomSession() {
|
|
20
20
|
const bytes = new Uint8Array(12);
|
|
21
|
+
//node-compat: crypto (global) (the browsers; on Node.js, SignalingClient gives the session itself)
|
|
21
22
|
globalThis.crypto.getRandomValues(bytes);
|
|
22
23
|
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
23
24
|
}
|
|
@@ -161,7 +161,9 @@ export class TURNWorkers {
|
|
|
161
161
|
port: this.#port,
|
|
162
162
|
...data.options.tls && this.#tlsPort !== undefined ? { tls: { ...data.options.tls, port: this.#tlsPort } } : {}
|
|
163
163
|
};
|
|
164
|
-
|
|
164
|
+
//Without the options of the command line of the process, which a worker inherits: with --input-type=module, its code
|
|
165
|
+
//(CommonJS) would run as an ES module
|
|
166
|
+
const worker = new Worker(turnWorkerCode, { eval: true, execArgv: [], workerData: { ...data, options: options } });
|
|
165
167
|
slot.worker = worker;
|
|
166
168
|
if (hasDebugHandler())
|
|
167
169
|
worker.postMessage({ type: 'debug', enabled: true });
|
|
@@ -2,7 +2,7 @@ import { Exception } from '@lakutata/core';
|
|
|
2
2
|
/**
|
|
3
3
|
* Thrown when `SignalingClient` cannot use the transport of its URL: Socket.IO (an `http:` or `https:` URL) needs the
|
|
4
4
|
* package `socket.io-client`, JSON-RPC (a `ws:` or `wss:` URL) needs the global `WebSocket` (Node.js 22 and later,
|
|
5
|
-
* Bun)
|
|
5
|
+
* Bun) or the package `ws`. Its `errno` is `'E_SIGNALING_CONNECTION'`.
|
|
6
6
|
*/
|
|
7
7
|
export declare class SignalingConnectionException extends Exception {
|
|
8
8
|
/**
|
|
@@ -56,6 +56,7 @@ export declare class RTCPeerConnection extends EventTarget {
|
|
|
56
56
|
private readonly sctpManager;
|
|
57
57
|
private readonly secureManager;
|
|
58
58
|
private isClosed;
|
|
59
|
+
private closing?;
|
|
59
60
|
private shouldNegotiationneeded;
|
|
60
61
|
private lastCreatedAnswer?;
|
|
61
62
|
private lastCreatedOffer?;
|
|
@@ -307,6 +308,7 @@ export declare class RTCPeerConnection extends EventTarget {
|
|
|
307
308
|
private createPeerConnectionStats;
|
|
308
309
|
getStats(selector?: MediaStreamTrack | null): Promise<RTCStatsReport>;
|
|
309
310
|
close(): Promise<void>;
|
|
311
|
+
private closeOnce;
|
|
310
312
|
private completePeerEvents;
|
|
311
313
|
}
|
|
312
314
|
export type DebugConfig = Partial<{
|
|
@@ -75,7 +75,8 @@ export interface SignalingClientOptions {
|
|
|
75
75
|
* A lakutata application as a member of the rooms of a signaling server of this package (`Signaling` and
|
|
76
76
|
* `SignalingController`, on this application or another one): it joins rooms and connects to their other members,
|
|
77
77
|
* browsers or applications, with {@link PeerConnection}s. Over Socket.IO (an `http:` or `https:` URL, with the package
|
|
78
|
-
* `socket.io-client`) or JSON-RPC over WebSocket (a `ws:` or `wss:` URL, with the `WebSocket` of Node.js 22 and
|
|
78
|
+
* `socket.io-client`) or JSON-RPC over WebSocket (a `ws:` or `wss:` URL, with the global `WebSocket` of Node.js 22 and
|
|
79
|
+
* later and of Bun, else the package `ws`);
|
|
79
80
|
* it reconnects by itself and joins its rooms again, keeping the peer-to-peer connections.
|
|
80
81
|
*
|
|
81
82
|
* Get a new one with `getObject(SignalingClient, options)` (it is `@Transient`, and needs no registration); `close()`
|
|
@@ -60,7 +60,7 @@ export interface SocketIOSocketLike {
|
|
|
60
60
|
off(event: string, listener?: (...args: any[]) => void): unknown;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* What the signaling needs of a WebSocket (`WebSocket` of the browsers, of Node.js 22 and of Bun) speaking JSON-RPC to
|
|
63
|
+
* What the signaling needs of a WebSocket (`WebSocket` of the browsers, of Node.js 22 and of Bun, of the package `ws`) speaking JSON-RPC to
|
|
64
64
|
* the server; its client id is the `id` query parameter of its URL.
|
|
65
65
|
*/
|
|
66
66
|
export interface WebSocketLike {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lakutata/webrtc",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.6",
|
|
4
4
|
"description": "WebRTC for the lakutata framework, in TypeScript without native code: the signaling, a STUN/TURN server, a media server (SFU) for rooms of many members, WHIP publishing and WHEP playback, peer connections with data channels and audio and video tracks in Node.js, Electron and Bun, the service actions of an application called through data channels, and a browser client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lakutata",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"test:electron": "electron test-env/electron/main.mjs"
|
|
78
78
|
},
|
|
79
79
|
"engines": {
|
|
80
|
-
"node": "
|
|
80
|
+
"node": ">=18.10.0"
|
|
81
81
|
},
|
|
82
82
|
"files": [
|
|
83
83
|
"dist",
|
|
@@ -88,11 +88,12 @@
|
|
|
88
88
|
"THIRD_PARTY_NOTICES.md"
|
|
89
89
|
],
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@lakutata/core": "~3.1.
|
|
92
|
-
"@lakutata/entrypoint": "~3.1.
|
|
91
|
+
"@lakutata/core": "~3.1.6",
|
|
92
|
+
"@lakutata/entrypoint": "~3.1.6",
|
|
93
93
|
"ioredis": "^5.0.0",
|
|
94
94
|
"nats": "^2.29.3",
|
|
95
|
-
"socket.io-client": "^4.0.0"
|
|
95
|
+
"socket.io-client": "^4.0.0",
|
|
96
|
+
"ws": "^8.0.0"
|
|
96
97
|
},
|
|
97
98
|
"peerDependenciesMeta": {
|
|
98
99
|
"@lakutata/core": {
|
|
@@ -109,6 +110,9 @@
|
|
|
109
110
|
},
|
|
110
111
|
"socket.io-client": {
|
|
111
112
|
"optional": true
|
|
113
|
+
},
|
|
114
|
+
"ws": {
|
|
115
|
+
"optional": true
|
|
112
116
|
}
|
|
113
117
|
},
|
|
114
118
|
"devDependencies": {
|