node-datachannel 0.26.0 → 0.28.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/.eslintrc.json +25 -25
- package/.prettierignore +4 -0
- package/.prettierrc +1 -0
- package/API.md +4 -4
- package/BULDING.md +11 -2
- package/CMakeLists.txt +37 -13
- package/README.md +22 -18
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/lib/datachannel-stream.cjs +13 -13
- package/dist/cjs/lib/datachannel-stream.cjs.map +1 -1
- package/dist/cjs/lib/index.cjs +1 -3
- package/dist/cjs/lib/index.cjs.map +1 -1
- package/dist/cjs/lib/websocket-server.cjs.map +1 -1
- package/dist/cjs/lib/websocket.cjs.map +1 -1
- package/dist/cjs/polyfill/Events.cjs +52 -3
- package/dist/cjs/polyfill/Events.cjs.map +1 -1
- package/dist/cjs/polyfill/Exception.cjs.map +1 -1
- package/dist/cjs/polyfill/RTCCertificate.cjs +5 -2
- package/dist/cjs/polyfill/RTCCertificate.cjs.map +1 -1
- package/dist/cjs/polyfill/RTCDataChannel.cjs +27 -19
- package/dist/cjs/polyfill/RTCDataChannel.cjs.map +1 -1
- package/dist/cjs/polyfill/RTCDtlsTransport.cjs +6 -5
- package/dist/cjs/polyfill/RTCDtlsTransport.cjs.map +1 -1
- package/dist/cjs/polyfill/RTCError.cjs +9 -2
- package/dist/cjs/polyfill/RTCError.cjs.map +1 -1
- package/dist/cjs/polyfill/RTCIceCandidate.cjs +13 -8
- package/dist/cjs/polyfill/RTCIceCandidate.cjs.map +1 -1
- package/dist/cjs/polyfill/RTCIceTransport.cjs +26 -16
- package/dist/cjs/polyfill/RTCIceTransport.cjs.map +1 -1
- package/dist/cjs/polyfill/RTCPeerConnection.cjs +80 -70
- package/dist/cjs/polyfill/RTCPeerConnection.cjs.map +1 -1
- package/dist/cjs/polyfill/RTCSctpTransport.cjs +9 -11
- package/dist/cjs/polyfill/RTCSctpTransport.cjs.map +1 -1
- package/dist/cjs/polyfill/RTCSessionDescription.cjs +10 -2
- package/dist/cjs/polyfill/RTCSessionDescription.cjs.map +1 -1
- package/dist/cjs/polyfill/index.cjs.map +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/lib/datachannel-stream.mjs.map +1 -1
- package/dist/esm/lib/index.mjs +1 -3
- package/dist/esm/lib/index.mjs.map +1 -1
- package/dist/esm/lib/websocket-server.mjs.map +1 -1
- package/dist/esm/lib/websocket.mjs.map +1 -1
- package/dist/esm/polyfill/Events.mjs +52 -4
- package/dist/esm/polyfill/Events.mjs.map +1 -1
- package/dist/esm/polyfill/Exception.mjs.map +1 -1
- package/dist/esm/polyfill/RTCCertificate.mjs +5 -2
- package/dist/esm/polyfill/RTCCertificate.mjs.map +1 -1
- package/dist/esm/polyfill/RTCDataChannel.mjs +27 -19
- package/dist/esm/polyfill/RTCDataChannel.mjs.map +1 -1
- package/dist/esm/polyfill/RTCDtlsTransport.mjs +6 -5
- package/dist/esm/polyfill/RTCDtlsTransport.mjs.map +1 -1
- package/dist/esm/polyfill/RTCError.mjs +9 -2
- package/dist/esm/polyfill/RTCError.mjs.map +1 -1
- package/dist/esm/polyfill/RTCIceCandidate.mjs +13 -8
- package/dist/esm/polyfill/RTCIceCandidate.mjs.map +1 -1
- package/dist/esm/polyfill/RTCIceTransport.mjs +26 -17
- package/dist/esm/polyfill/RTCIceTransport.mjs.map +1 -1
- package/dist/esm/polyfill/RTCPeerConnection.mjs +80 -70
- package/dist/esm/polyfill/RTCPeerConnection.mjs.map +1 -1
- package/dist/esm/polyfill/RTCSctpTransport.mjs +9 -11
- package/dist/esm/polyfill/RTCSctpTransport.mjs.map +1 -1
- package/dist/esm/polyfill/RTCSessionDescription.mjs +10 -2
- package/dist/esm/polyfill/RTCSessionDescription.mjs.map +1 -1
- package/dist/esm/polyfill/index.mjs.map +1 -1
- package/dist/types/lib/index.d.ts +5 -2
- package/dist/types/lib/types.d.ts +6 -6
- package/dist/types/polyfill/Events.d.ts +3 -3
- package/dist/types/polyfill/RTCCertificate.d.ts +1 -0
- package/dist/types/polyfill/RTCDataChannel.d.ts +6 -6
- package/dist/types/polyfill/RTCDtlsTransport.d.ts +4 -6
- package/dist/types/polyfill/RTCError.d.ts +1 -0
- package/dist/types/polyfill/RTCIceCandidate.d.ts +1 -1
- package/dist/types/polyfill/RTCIceTransport.d.ts +16 -10
- package/dist/types/polyfill/RTCPeerConnection.d.ts +29 -22
- package/dist/types/polyfill/RTCSctpTransport.d.ts +2 -4
- package/dist/types/polyfill/RTCSessionDescription.d.ts +1 -0
- package/jest.config.ts +8 -8
- package/package.json +114 -112
- package/rollup.config.mjs +1 -1
- package/src/cpp/data-channel-wrapper.cpp +11 -0
- package/src/cpp/main.cpp +14 -0
- package/src/cpp/peer-connection-wrapper.cpp +9 -1
- package/src/cpp/peer-connection-wrapper.h +5 -1
- package/src/cpp/rtc-wrapper.cpp +18 -0
- package/src/index.ts +0 -1
- package/src/lib/datachannel-stream.ts +83 -84
- package/src/lib/index.ts +165 -139
- package/src/lib/types.ts +97 -72
- package/src/lib/websocket-server.ts +25 -25
- package/src/lib/websocket.ts +19 -19
- package/src/polyfill/Events.ts +65 -19
- package/src/polyfill/Exception.ts +24 -24
- package/src/polyfill/README.md +8 -8
- package/src/polyfill/RTCCertificate.ts +16 -12
- package/src/polyfill/RTCDataChannel.ts +198 -192
- package/src/polyfill/RTCDtlsTransport.ts +38 -39
- package/src/polyfill/RTCError.ts +63 -56
- package/src/polyfill/RTCIceCandidate.ts +120 -116
- package/src/polyfill/RTCIceTransport.ts +71 -64
- package/src/polyfill/RTCPeerConnection.ts +436 -420
- package/src/polyfill/RTCSctpTransport.ts +43 -47
- package/src/polyfill/RTCSessionDescription.ts +26 -17
- package/src/polyfill/index.ts +22 -22
|
@@ -10,31 +10,30 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
10
10
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
11
11
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
12
12
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
13
|
-
var _pc,
|
|
13
|
+
var _pc, _transport;
|
|
14
14
|
class RTCSctpTransport extends EventTarget {
|
|
15
15
|
constructor(initial) {
|
|
16
16
|
super();
|
|
17
17
|
__privateAdd(this, _pc, null);
|
|
18
|
-
__privateAdd(this, _extraFunctions, null);
|
|
19
18
|
__privateAdd(this, _transport, null);
|
|
20
19
|
__publicField(this, "onstatechange", null);
|
|
21
20
|
__privateSet(this, _pc, initial.pc);
|
|
22
|
-
__privateSet(this,
|
|
23
|
-
|
|
21
|
+
__privateSet(this, _transport, new RTCDtlsTransport({
|
|
22
|
+
pc: initial.pc
|
|
23
|
+
}));
|
|
24
24
|
__privateGet(this, _pc).addEventListener("connectionstatechange", () => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (this.onstatechange) this.onstatechange(e);
|
|
25
|
+
const e = new Event("statechange");
|
|
26
|
+
this.dispatchEvent(e);
|
|
27
|
+
this.onstatechange?.(e);
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
get maxChannels() {
|
|
32
31
|
if (this.state !== "connected") return null;
|
|
33
|
-
return __privateGet(this, _pc)
|
|
32
|
+
return __privateGet(this, _pc).ext_maxDataChannelId;
|
|
34
33
|
}
|
|
35
34
|
get maxMessageSize() {
|
|
36
35
|
if (this.state !== "connected") return null;
|
|
37
|
-
return __privateGet(this, _pc)
|
|
36
|
+
return __privateGet(this, _pc)?.ext_maxMessageSize ?? 65536;
|
|
38
37
|
}
|
|
39
38
|
get state() {
|
|
40
39
|
let state = __privateGet(this, _pc).connectionState;
|
|
@@ -50,7 +49,6 @@ class RTCSctpTransport extends EventTarget {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
_pc = new WeakMap();
|
|
53
|
-
_extraFunctions = new WeakMap();
|
|
54
52
|
_transport = new WeakMap();
|
|
55
53
|
|
|
56
54
|
export { RTCSctpTransport as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RTCSctpTransport.mjs","sources":["../../../src/polyfill/RTCSctpTransport.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport RTCDtlsTransport from './RTCDtlsTransport';\nimport RTCPeerConnection from './RTCPeerConnection';\n\nexport default class RTCSctpTransport extends EventTarget implements globalThis.RTCSctpTransport {\n
|
|
1
|
+
{"version":3,"file":"RTCSctpTransport.mjs","sources":["../../../src/polyfill/RTCSctpTransport.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport RTCDtlsTransport from './RTCDtlsTransport';\nimport RTCPeerConnection from './RTCPeerConnection';\n\nexport default class RTCSctpTransport extends EventTarget implements globalThis.RTCSctpTransport {\n #pc: RTCPeerConnection = null;\n #transport: globalThis.RTCDtlsTransport = null;\n\n onstatechange: globalThis.RTCSctpTransport['onstatechange'] = null;\n\n constructor(initial: { pc: RTCPeerConnection }) {\n super();\n this.#pc = initial.pc;\n\n this.#transport = new RTCDtlsTransport({\n pc: initial.pc\n });\n\n this.#pc.addEventListener('connectionstatechange', () => {\n const e = new Event('statechange');\n this.dispatchEvent(e);\n this.onstatechange?.(e);\n });\n }\n\n get maxChannels(): number | null {\n if (this.state !== 'connected') return null;\n return this.#pc.ext_maxDataChannelId;\n }\n\n get maxMessageSize(): number {\n if (this.state !== 'connected') return null;\n return this.#pc?.ext_maxMessageSize ?? 65536;;\n }\n\n get state(): globalThis.RTCSctpTransportState {\n // reduce state from new, connecting, connected, disconnected, failed, closed, unknown\n // to RTCSctpTransport states connecting, connected, closed\n let state = this.#pc.connectionState;\n if (state === 'new' || state === 'connecting') {\n state = 'connecting';\n } else if (state === 'disconnected' || state === 'failed' || state === 'closed') {\n state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,YAAA,CAAA,IAAA,EAAK,MAAK,kBAAsB,IAAA,KAAA,CAAA;AAAM,GAC/C;AAAA,EAEA,IAAI,KAA0C,GAAA;AAG5C,IAAI,IAAA,KAAA,GAAQ,mBAAK,GAAI,CAAA,CAAA,eAAA,CAAA;AACrB,IAAI,IAAA,KAAA,KAAU,KAAS,IAAA,KAAA,KAAU,YAAc,EAAA;AAC7C,MAAQ,KAAA,GAAA,YAAA,CAAA;AAAA,eACC,KAAU,KAAA,cAAA,IAAkB,KAAU,KAAA,QAAA,IAAY,UAAU,QAAU,EAAA;AAC/E,MAAQ,KAAA,GAAA,QAAA,CAAA;AAAA,KACV;AACA,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAAA,EAEA,IAAI,SAAyC,GAAA;AAC3C,IAAA,OAAO,YAAK,CAAA,IAAA,EAAA,UAAA,CAAA,CAAA;AAAA,GACd;AACF,CAAA;AA7CE,GAAA,GAAA,IAAA,OAAA,EAAA,CAAA;AACA,UAAA,GAAA,IAAA,OAAA,EAAA;;;;"}
|
|
@@ -10,12 +10,20 @@ class RTCSessionDescription {
|
|
|
10
10
|
constructor(init) {
|
|
11
11
|
__privateAdd(this, _type);
|
|
12
12
|
__privateAdd(this, _sdp);
|
|
13
|
-
__privateSet(this, _type, init
|
|
14
|
-
__privateSet(this, _sdp, init
|
|
13
|
+
__privateSet(this, _type, init?.type);
|
|
14
|
+
__privateSet(this, _sdp, init?.sdp ?? "");
|
|
15
15
|
}
|
|
16
16
|
get type() {
|
|
17
17
|
return __privateGet(this, _type);
|
|
18
18
|
}
|
|
19
|
+
set type(type) {
|
|
20
|
+
if (type !== "offer" && type !== "answer" && type !== "pranswer" && type !== "rollback") {
|
|
21
|
+
throw new TypeError(
|
|
22
|
+
`Failed to set the 'type' property on 'RTCSessionDescription': The provided value '${type}' is not a valid enum value of type RTCSdpType.`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
__privateSet(this, _type, type);
|
|
26
|
+
}
|
|
19
27
|
get sdp() {
|
|
20
28
|
return __privateGet(this, _sdp);
|
|
21
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RTCSessionDescription.mjs","sources":["../../../src/polyfill/RTCSessionDescription.ts"],"sourcesContent":["// https://developer.mozilla.org/docs/Web/API/RTCSessionDescription\n//\n// Example usage\n// const init = {\n// type: 'offer',\n// sdp: 'v=0\\r\\no=- 1234567890 1234567890 IN IP4 192.168.1.1\\r\\ns=-\\r\\nt=0 0\\r\\na=ice-ufrag:abcd\\r\\na=ice-pwd:efgh\\r\\n'\n// };\n\nexport default class RTCSessionDescription implements globalThis.RTCSessionDescriptionInit {\n
|
|
1
|
+
{"version":3,"file":"RTCSessionDescription.mjs","sources":["../../../src/polyfill/RTCSessionDescription.ts"],"sourcesContent":["// https://developer.mozilla.org/docs/Web/API/RTCSessionDescription\n//\n// Example usage\n// const init = {\n// type: 'offer',\n// sdp: 'v=0\\r\\no=- 1234567890 1234567890 IN IP4 192.168.1.1\\r\\ns=-\\r\\nt=0 0\\r\\na=ice-ufrag:abcd\\r\\na=ice-pwd:efgh\\r\\n'\n// };\n\nexport default class RTCSessionDescription implements globalThis.RTCSessionDescriptionInit {\n #type: globalThis.RTCSdpType;\n #sdp: string;\n\n constructor(init: globalThis.RTCSessionDescriptionInit) {\n this.#type = init?.type;\n this.#sdp = init?.sdp ?? '';\n }\n\n get type(): globalThis.RTCSdpType {\n return this.#type;\n }\n\n set type(type) {\n if (type !== 'offer' && type !== 'answer' && type !== 'pranswer' && type !== 'rollback') {\n throw new TypeError(\n `Failed to set the 'type' property on 'RTCSessionDescription': The provided value '${type}' is not a valid enum value of type RTCSdpType.`,\n );\n }\n this.#type = type;\n }\n\n get sdp(): string {\n return this.#sdp;\n }\n\n toJSON(): globalThis.RTCSessionDescriptionInit {\n return {\n sdp: this.#sdp,\n type: this.#type,\n };\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,EAAA,IAAA,CAAA;AAQA,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';\nimport RTCDataChannel from './RTCDataChannel';\nimport RTCDtlsTransport from './RTCDtlsTransport';\nimport RTCIceCandidate from './RTCIceCandidate';\nimport RTCIceTransport from './RTCIceTransport';\nimport RTCPeerConnection from './RTCPeerConnection';\nimport RTCSctpTransport from './RTCSctpTransport';\nimport RTCSessionDescription from './RTCSessionDescription';\nimport { RTCDataChannelEvent, RTCPeerConnectionIceEvent } from './Events';\nimport RTCError from './RTCError';\n\nexport {\n
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/polyfill/index.ts"],"sourcesContent":["import RTCCertificate from './RTCCertificate';\nimport RTCDataChannel from './RTCDataChannel';\nimport RTCDtlsTransport from './RTCDtlsTransport';\nimport RTCIceCandidate from './RTCIceCandidate';\nimport RTCIceTransport from './RTCIceTransport';\nimport RTCPeerConnection from './RTCPeerConnection';\nimport RTCSctpTransport from './RTCSctpTransport';\nimport RTCSessionDescription from './RTCSessionDescription';\nimport { RTCDataChannelEvent, RTCPeerConnectionIceEvent } from './Events';\nimport RTCError from './RTCError';\n\nexport {\n RTCCertificate,\n RTCDataChannel,\n RTCDtlsTransport,\n RTCIceCandidate,\n RTCIceTransport,\n RTCPeerConnection,\n RTCSctpTransport,\n RTCSessionDescription,\n RTCDataChannelEvent,\n RTCPeerConnectionIceEvent,\n RTCError,\n};\n\nexport default {\n RTCCertificate,\n RTCDataChannel,\n RTCDtlsTransport,\n RTCIceCandidate,\n RTCIceTransport,\n RTCPeerConnection,\n RTCSctpTransport,\n RTCSessionDescription,\n RTCDataChannelEvent,\n RTCPeerConnectionIceEvent,\n RTCError,\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAyBA,QAAe;AAAA,EACb,cAAA;AAAA,EACA,cAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA,iBAAA;AAAA,EACA,gBAAA;AAAA,EACA,qBAAA;AAAA,EACA,mBAAA;AAAA,EACA,yBAAA;AAAA,EACA,QAAA;AACF,CAAA;;;;"}
|
|
@@ -143,8 +143,11 @@ interface PeerConnection {
|
|
|
143
143
|
declare const PeerConnection: {
|
|
144
144
|
new (peerName: string, config: RtcConfig): PeerConnection;
|
|
145
145
|
};
|
|
146
|
-
|
|
146
|
+
interface RtcpReceivingSession {
|
|
147
147
|
}
|
|
148
|
+
declare const RtcpReceivingSession: {
|
|
149
|
+
new (): RtcpReceivingSession;
|
|
150
|
+
};
|
|
148
151
|
|
|
149
152
|
declare const DataChannelStream: typeof DataChannelStream$1;
|
|
150
153
|
declare const _default: {
|
|
@@ -153,7 +156,7 @@ declare const _default: {
|
|
|
153
156
|
preload: typeof preload;
|
|
154
157
|
setSctpSettings: typeof setSctpSettings;
|
|
155
158
|
getLibraryVersion: typeof getLibraryVersion;
|
|
156
|
-
RtcpReceivingSession:
|
|
159
|
+
RtcpReceivingSession: new () => RtcpReceivingSession;
|
|
157
160
|
Track: new () => Track;
|
|
158
161
|
Video: new (mid: string, dir: Direction) => Video;
|
|
159
162
|
Audio: new (mid: string, dir: Direction) => Audio;
|
|
@@ -65,12 +65,12 @@ interface RtcConfig {
|
|
|
65
65
|
}
|
|
66
66
|
type DescriptionType = 'unspec' | 'offer' | 'answer' | 'pranswer' | 'rollback';
|
|
67
67
|
type RTCSdpType = 'answer' | 'offer' | 'pranswer' | 'rollback';
|
|
68
|
-
type RTCIceTransportState =
|
|
69
|
-
type RTCPeerConnectionState =
|
|
70
|
-
type RTCIceConnectionState =
|
|
71
|
-
type RTCIceGathererState =
|
|
72
|
-
type RTCIceGatheringState =
|
|
73
|
-
type RTCSignalingState =
|
|
68
|
+
type RTCIceTransportState = 'checking' | 'closed' | 'completed' | 'connected' | 'disconnected' | 'failed' | 'new';
|
|
69
|
+
type RTCPeerConnectionState = 'closed' | 'connected' | 'connecting' | 'disconnected' | 'failed' | 'new';
|
|
70
|
+
type RTCIceConnectionState = 'checking' | 'closed' | 'completed' | 'connected' | 'disconnected' | 'failed' | 'new';
|
|
71
|
+
type RTCIceGathererState = 'complete' | 'gathering' | 'new';
|
|
72
|
+
type RTCIceGatheringState = 'complete' | 'gathering' | 'new';
|
|
73
|
+
type RTCSignalingState = 'closed' | 'have-local-offer' | 'have-local-pranswer' | 'have-remote-offer' | 'have-remote-pranswer' | 'stable';
|
|
74
74
|
interface DataChannelInitConfig {
|
|
75
75
|
protocol?: string;
|
|
76
76
|
negotiated?: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import RTCDataChannel from './RTCDataChannel.js';
|
|
2
|
-
import RTCIceCandidate from './RTCIceCandidate.js';
|
|
3
2
|
|
|
4
3
|
declare class RTCPeerConnectionIceEvent extends Event implements globalThis.RTCPeerConnectionIceEvent {
|
|
5
4
|
#private;
|
|
6
|
-
constructor(candidate: RTCIceCandidate);
|
|
7
|
-
get candidate(): RTCIceCandidate;
|
|
5
|
+
constructor(candidate: globalThis.RTCIceCandidate);
|
|
6
|
+
get candidate(): globalThis.RTCIceCandidate;
|
|
7
|
+
get url(): string;
|
|
8
8
|
}
|
|
9
9
|
declare class RTCDataChannelEvent extends Event implements globalThis.RTCDataChannelEvent {
|
|
10
10
|
#private;
|
|
@@ -2,12 +2,12 @@ import { DataChannel } from '../lib/index';
|
|
|
2
2
|
|
|
3
3
|
declare class RTCDataChannel extends EventTarget implements globalThis.RTCDataChannel {
|
|
4
4
|
#private;
|
|
5
|
-
onbufferedamountlow:
|
|
6
|
-
onclose:
|
|
7
|
-
onclosing:
|
|
8
|
-
onerror:
|
|
9
|
-
onmessage:
|
|
10
|
-
onopen:
|
|
5
|
+
onbufferedamountlow: globalThis.RTCDataChannel['onbufferedamountlow'];
|
|
6
|
+
onclose: globalThis.RTCDataChannel['onclose'];
|
|
7
|
+
onclosing: globalThis.RTCDataChannel['onclosing'];
|
|
8
|
+
onerror: globalThis.RTCDataChannel['onerror'];
|
|
9
|
+
onmessage: globalThis.RTCDataChannel['onmessage'];
|
|
10
|
+
onopen: globalThis.RTCDataChannel['onopen'];
|
|
11
11
|
constructor(dataChannel: DataChannel, opts?: globalThis.RTCDataChannelInit);
|
|
12
12
|
set binaryType(type: BinaryType);
|
|
13
13
|
get binaryType(): BinaryType;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import RTCIceTransport from './RTCIceTransport.js';
|
|
2
1
|
import RTCPeerConnection from './RTCPeerConnection.js';
|
|
3
2
|
|
|
4
3
|
declare class RTCDtlsTransport extends EventTarget implements globalThis.RTCDtlsTransport {
|
|
5
4
|
#private;
|
|
6
|
-
onstatechange:
|
|
7
|
-
onerror:
|
|
5
|
+
onstatechange: globalThis.RTCDtlsTransport['onstatechange'];
|
|
6
|
+
onerror: globalThis.RTCDtlsTransport['onstatechange'];
|
|
8
7
|
constructor(init: {
|
|
9
8
|
pc: RTCPeerConnection;
|
|
10
|
-
extraFunctions: any;
|
|
11
9
|
});
|
|
12
|
-
get iceTransport(): RTCIceTransport;
|
|
13
|
-
get state(): RTCDtlsTransportState;
|
|
10
|
+
get iceTransport(): globalThis.RTCIceTransport;
|
|
11
|
+
get state(): globalThis.RTCDtlsTransportState;
|
|
14
12
|
getRemoteCertificates(): ArrayBuffer[];
|
|
15
13
|
}
|
|
16
14
|
|
|
@@ -7,6 +7,7 @@ declare class RTCError extends DOMException implements globalThis.RTCError {
|
|
|
7
7
|
set receivedAlert(_value: number | null);
|
|
8
8
|
get sctpCauseCode(): number | null;
|
|
9
9
|
set sctpCauseCode(_value: number | null);
|
|
10
|
+
get httpRequestStatusCode(): number | null;
|
|
10
11
|
get sdpLineNumber(): number | null;
|
|
11
12
|
set sdpLineNumber(_value: number | null);
|
|
12
13
|
get sentAlert(): number | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare class RTCIceCandidate implements globalThis.RTCIceCandidate {
|
|
2
2
|
#private;
|
|
3
|
-
constructor({ candidate, sdpMLineIndex, sdpMid, usernameFragment }: globalThis.RTCIceCandidateInit);
|
|
3
|
+
constructor({ candidate, sdpMLineIndex, sdpMid, usernameFragment, }: globalThis.RTCIceCandidateInit);
|
|
4
4
|
get address(): string | null;
|
|
5
5
|
get candidate(): string;
|
|
6
6
|
get component(): globalThis.RTCIceComponent | null;
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
import RTCIceCandidate from './RTCIceCandidate.js';
|
|
2
1
|
import RTCPeerConnection from './RTCPeerConnection.js';
|
|
3
2
|
|
|
4
3
|
declare class RTCIceTransport extends EventTarget implements globalThis.RTCIceTransport {
|
|
5
4
|
#private;
|
|
6
|
-
ongatheringstatechange:
|
|
7
|
-
onselectedcandidatepairchange:
|
|
8
|
-
onstatechange:
|
|
5
|
+
ongatheringstatechange: globalThis.RTCIceTransport['ongatheringstatechange'];
|
|
6
|
+
onselectedcandidatepairchange: globalThis.RTCIceTransport['onselectedcandidatepairchange'];
|
|
7
|
+
onstatechange: globalThis.RTCIceTransport['onstatechange'];
|
|
9
8
|
constructor(init: {
|
|
10
9
|
pc: RTCPeerConnection;
|
|
11
|
-
extraFunctions: any;
|
|
12
10
|
});
|
|
13
11
|
get component(): globalThis.RTCIceComponent;
|
|
14
12
|
get gatheringState(): globalThis.RTCIceGatheringState;
|
|
15
|
-
get role():
|
|
13
|
+
get role(): globalThis.RTCIceRole;
|
|
16
14
|
get state(): globalThis.RTCIceTransportState;
|
|
17
|
-
getLocalCandidates(): RTCIceCandidate[];
|
|
18
|
-
getLocalParameters():
|
|
19
|
-
getRemoteCandidates(): RTCIceCandidate[];
|
|
15
|
+
getLocalCandidates(): globalThis.RTCIceCandidate[];
|
|
16
|
+
getLocalParameters(): RTCIceParameters | null;
|
|
17
|
+
getRemoteCandidates(): globalThis.RTCIceCandidate[];
|
|
20
18
|
getRemoteParameters(): any;
|
|
21
19
|
getSelectedCandidatePair(): globalThis.RTCIceCandidatePair | null;
|
|
22
20
|
}
|
|
21
|
+
declare class RTCIceParameters implements globalThis.RTCIceParameters {
|
|
22
|
+
usernameFragment: string;
|
|
23
|
+
password: string;
|
|
24
|
+
constructor({ usernameFragment, password }: {
|
|
25
|
+
usernameFragment: any;
|
|
26
|
+
password?: string;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
23
29
|
|
|
24
|
-
export { RTCIceTransport as default };
|
|
30
|
+
export { RTCIceParameters, RTCIceTransport as default };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { SelectedCandidateInfo } from '../lib/types';
|
|
1
2
|
import { PeerConnection } from '../lib/index';
|
|
2
|
-
import RTCSessionDescription from './RTCSessionDescription.js';
|
|
3
3
|
import RTCDataChannel from './RTCDataChannel.js';
|
|
4
|
-
import { RTCDataChannelEvent
|
|
5
|
-
import RTCSctpTransport from './RTCSctpTransport.js';
|
|
4
|
+
import { RTCDataChannelEvent } from './Events.js';
|
|
6
5
|
import RTCCertificate from './RTCCertificate.js';
|
|
7
6
|
|
|
8
7
|
interface RTCConfiguration extends globalThis.RTCConfiguration {
|
|
@@ -12,41 +11,49 @@ interface RTCConfiguration extends globalThis.RTCConfiguration {
|
|
|
12
11
|
declare class RTCPeerConnection extends EventTarget implements globalThis.RTCPeerConnection {
|
|
13
12
|
#private;
|
|
14
13
|
static generateCertificate(): Promise<RTCCertificate>;
|
|
15
|
-
onconnectionstatechange:
|
|
16
|
-
ondatachannel: ((this: RTCPeerConnection, ev: RTCDataChannelEvent) => any) | null;
|
|
17
|
-
onicecandidate:
|
|
18
|
-
onicecandidateerror:
|
|
19
|
-
oniceconnectionstatechange:
|
|
20
|
-
onicegatheringstatechange:
|
|
21
|
-
onnegotiationneeded:
|
|
22
|
-
onsignalingstatechange:
|
|
23
|
-
ontrack:
|
|
14
|
+
onconnectionstatechange: globalThis.RTCPeerConnection['onconnectionstatechange'];
|
|
15
|
+
ondatachannel: ((this: globalThis.RTCPeerConnection, ev: RTCDataChannelEvent) => any) | null;
|
|
16
|
+
onicecandidate: globalThis.RTCPeerConnection['onicecandidate'];
|
|
17
|
+
onicecandidateerror: globalThis.RTCPeerConnection['onicecandidateerror'];
|
|
18
|
+
oniceconnectionstatechange: globalThis.RTCPeerConnection['oniceconnectionstatechange'];
|
|
19
|
+
onicegatheringstatechange: globalThis.RTCPeerConnection['onicegatheringstatechange'];
|
|
20
|
+
onnegotiationneeded: globalThis.RTCPeerConnection['onnegotiationneeded'];
|
|
21
|
+
onsignalingstatechange: globalThis.RTCPeerConnection['onsignalingstatechange'];
|
|
22
|
+
ontrack: globalThis.RTCPeerConnection['ontrack'];
|
|
24
23
|
private _checkConfiguration;
|
|
25
|
-
setConfiguration(config: RTCConfiguration): void;
|
|
24
|
+
setConfiguration(config: globalThis.RTCConfiguration): void;
|
|
26
25
|
constructor(config?: RTCConfiguration);
|
|
26
|
+
get ext_maxDataChannelId(): number;
|
|
27
|
+
get ext_maxMessageSize(): number;
|
|
28
|
+
get ext_localCandidates(): globalThis.RTCIceCandidate[];
|
|
29
|
+
get ext_remoteCandidates(): globalThis.RTCIceCandidate[];
|
|
30
|
+
selectedCandidatePair(): {
|
|
31
|
+
local: SelectedCandidateInfo;
|
|
32
|
+
remote: SelectedCandidateInfo;
|
|
33
|
+
} | null;
|
|
27
34
|
get canTrickleIceCandidates(): boolean | null;
|
|
28
35
|
get connectionState(): globalThis.RTCPeerConnectionState;
|
|
29
36
|
get iceConnectionState(): globalThis.RTCIceConnectionState;
|
|
30
37
|
get iceGatheringState(): globalThis.RTCIceGatheringState;
|
|
31
|
-
get currentLocalDescription(): RTCSessionDescription;
|
|
32
|
-
get currentRemoteDescription(): RTCSessionDescription;
|
|
33
|
-
get localDescription(): RTCSessionDescription;
|
|
34
|
-
get pendingLocalDescription(): RTCSessionDescription;
|
|
35
|
-
get pendingRemoteDescription(): RTCSessionDescription;
|
|
36
|
-
get remoteDescription(): RTCSessionDescription;
|
|
37
|
-
get sctp(): RTCSctpTransport;
|
|
38
|
+
get currentLocalDescription(): globalThis.RTCSessionDescription;
|
|
39
|
+
get currentRemoteDescription(): globalThis.RTCSessionDescription;
|
|
40
|
+
get localDescription(): globalThis.RTCSessionDescription;
|
|
41
|
+
get pendingLocalDescription(): globalThis.RTCSessionDescription;
|
|
42
|
+
get pendingRemoteDescription(): globalThis.RTCSessionDescription;
|
|
43
|
+
get remoteDescription(): globalThis.RTCSessionDescription;
|
|
44
|
+
get sctp(): globalThis.RTCSctpTransport;
|
|
38
45
|
get signalingState(): globalThis.RTCSignalingState;
|
|
39
46
|
addIceCandidate(candidate?: globalThis.RTCIceCandidateInit | null): Promise<void>;
|
|
40
47
|
addTrack(_track: any, ..._streams: any[]): globalThis.RTCRtpSender;
|
|
41
48
|
addTransceiver(_trackOrKind: any, _init: any): globalThis.RTCRtpTransceiver;
|
|
42
49
|
close(): void;
|
|
43
50
|
createAnswer(): Promise<globalThis.RTCSessionDescriptionInit | any>;
|
|
44
|
-
createDataChannel(label:
|
|
51
|
+
createDataChannel(label: string, opts?: globalThis.RTCDataChannelInit): RTCDataChannel;
|
|
45
52
|
createOffer(): Promise<globalThis.RTCSessionDescriptionInit | any>;
|
|
46
53
|
getConfiguration(): globalThis.RTCConfiguration;
|
|
47
54
|
getReceivers(): globalThis.RTCRtpReceiver[];
|
|
48
55
|
getSenders(): globalThis.RTCRtpSender[];
|
|
49
|
-
getStats(): Promise<globalThis.RTCStatsReport
|
|
56
|
+
getStats(): Promise<globalThis.RTCStatsReport> | any;
|
|
50
57
|
getTransceivers(): globalThis.RTCRtpTransceiver[];
|
|
51
58
|
removeTrack(): void;
|
|
52
59
|
restartIce(): Promise<void>;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import RTCDtlsTransport from './RTCDtlsTransport.js';
|
|
2
1
|
import RTCPeerConnection from './RTCPeerConnection.js';
|
|
3
2
|
|
|
4
3
|
declare class RTCSctpTransport extends EventTarget implements globalThis.RTCSctpTransport {
|
|
5
4
|
#private;
|
|
6
|
-
onstatechange:
|
|
5
|
+
onstatechange: globalThis.RTCSctpTransport['onstatechange'];
|
|
7
6
|
constructor(initial: {
|
|
8
7
|
pc: RTCPeerConnection;
|
|
9
|
-
extraFunctions: any;
|
|
10
8
|
});
|
|
11
9
|
get maxChannels(): number | null;
|
|
12
10
|
get maxMessageSize(): number;
|
|
13
11
|
get state(): globalThis.RTCSctpTransportState;
|
|
14
|
-
get transport(): RTCDtlsTransport;
|
|
12
|
+
get transport(): globalThis.RTCDtlsTransport;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
export { RTCSctpTransport as default };
|
|
@@ -2,6 +2,7 @@ declare class RTCSessionDescription implements globalThis.RTCSessionDescriptionI
|
|
|
2
2
|
#private;
|
|
3
3
|
constructor(init: globalThis.RTCSessionDescriptionInit);
|
|
4
4
|
get type(): globalThis.RTCSdpType;
|
|
5
|
+
set type(type: globalThis.RTCSdpType);
|
|
5
6
|
get sdp(): string;
|
|
6
7
|
toJSON(): globalThis.RTCSessionDescriptionInit;
|
|
7
8
|
}
|
package/jest.config.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Config } from 'jest';
|
|
2
2
|
|
|
3
3
|
const config: Config = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
clearMocks: true,
|
|
5
|
+
collectCoverage: false,
|
|
6
|
+
coverageDirectory: 'coverage',
|
|
7
|
+
coverageProvider: 'v8',
|
|
8
|
+
preset: 'ts-jest',
|
|
9
|
+
testEnvironment: 'jest-environment-node',
|
|
10
|
+
testRegex: '(/test/jest-tests/.*|(\\.|/)(test|spec))\\.(m)?ts$',
|
|
11
|
+
testPathIgnorePatterns: ['node_modules', 'multiple-run.test'],
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export default config;
|