@lakutata/webrtc 3.1.1 → 3.1.5

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.
@@ -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
  }
@@ -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). Its `errno` is `'E_SIGNALING_CONNECTION'`.
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 of Bun);
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.1",
3
+ "version": "3.1.5",
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": "^22.13.0 || >=24.11.0"
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.1",
92
- "@lakutata/entrypoint": "3.1.1",
91
+ "@lakutata/core": "~3.1.5",
92
+ "@lakutata/entrypoint": "~3.1.5",
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": {