node-datachannel 0.3.1 → 0.3.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/.github/workflows/lint.yml +22 -0
- package/CMakeLists.txt +2 -2
- package/examples/client-server/client-benchmark.js +43 -32
- package/examples/client-server/client-periodic.js +30 -14
- package/examples/client-server/client.js +6 -5
- package/examples/client-server/package-lock.json +183 -44
- package/examples/client-server/signaling-server.js +3 -5
- package/examples/media/media.js +9 -9
- package/lib/index.d.ts +100 -100
- package/node_modules/lru-cache/package.json +2 -4
- package/node_modules/minimist/package.json +0 -1
- package/node_modules/node-abi/node_modules/semver/README.md +3 -1
- package/node_modules/node-abi/node_modules/semver/bin/semver.js +19 -9
- package/node_modules/node-abi/node_modules/semver/classes/comparator.js +3 -2
- package/node_modules/node-abi/node_modules/semver/classes/index.js +1 -1
- package/node_modules/node-abi/node_modules/semver/classes/range.js +31 -22
- package/node_modules/node-abi/node_modules/semver/classes/semver.js +1 -1
- package/node_modules/node-abi/node_modules/semver/functions/cmp.js +8 -4
- package/node_modules/node-abi/node_modules/semver/functions/coerce.js +3 -2
- package/node_modules/node-abi/node_modules/semver/functions/inc.js +4 -1
- package/node_modules/node-abi/node_modules/semver/functions/parse.js +1 -1
- package/node_modules/node-abi/node_modules/semver/internal/constants.js +2 -2
- package/node_modules/node-abi/node_modules/semver/internal/identifiers.js +1 -1
- package/node_modules/node-abi/node_modules/semver/internal/parse-options.js +3 -3
- package/node_modules/node-abi/node_modules/semver/internal/re.js +3 -3
- package/node_modules/node-abi/node_modules/semver/package.json +51 -18
- package/node_modules/node-abi/node_modules/semver/ranges/min-version.js +2 -1
- package/node_modules/node-abi/node_modules/semver/ranges/outside.js +1 -1
- package/node_modules/node-abi/node_modules/semver/ranges/simplify.js +15 -12
- package/node_modules/node-abi/node_modules/semver/ranges/subset.js +53 -31
- package/node_modules/npmlog/node_modules/are-we-there-yet/package.json +10 -10
- package/node_modules/npmlog/package.json +1 -1
- package/node_modules/tar-stream/node_modules/bl/.travis.yml +4 -3
- package/node_modules/tar-stream/node_modules/bl/BufferList.js +1 -1
- package/node_modules/tar-stream/node_modules/bl/package.json +10 -10
- package/node_modules/tar-stream/node_modules/bl/test/test.js +20 -2
- package/node_modules/wide-align/LICENSE +0 -0
- package/node_modules/wide-align/README.md +0 -0
- package/node_modules/wide-align/align.js +0 -0
- package/node_modules/wide-align/package.json +14 -14
- package/package.json +2 -2
- package/src/data-channel-wrapper.cpp +69 -53
- package/src/data-channel-wrapper.h +0 -1
- package/src/media-track-wrapper.cpp +91 -52
- package/src/media-track-wrapper.h +0 -1
- package/src/peer-connection-wrapper.cpp +106 -70
- package/src/peer-connection-wrapper.h +0 -2
- package/test/connectivity.js +18 -17
- package/test/test.js +22 -30
- package/node_modules/node-abi/node_modules/semver/CHANGELOG.md +0 -111
package/test/test.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
1
2
|
const nodeDataChannel = require('../lib/index');
|
|
2
3
|
|
|
3
4
|
describe('Module Definition', () => {
|
|
@@ -12,9 +13,8 @@ describe('Module Definition', () => {
|
|
|
12
13
|
});
|
|
13
14
|
|
|
14
15
|
describe('PeerConnection Classes', () => {
|
|
15
|
-
|
|
16
16
|
test('Create PeerConnection', () => {
|
|
17
|
-
let peer = new nodeDataChannel.PeerConnection(
|
|
17
|
+
let peer = new nodeDataChannel.PeerConnection('Peer', { iceServers: ['stun:stun.l.google.com:19302'] });
|
|
18
18
|
expect(peer).toBeDefined();
|
|
19
19
|
expect(peer.onStateChange).toBeDefined();
|
|
20
20
|
expect(peer.createDataChannel).toBeDefined();
|
|
@@ -23,7 +23,7 @@ describe('PeerConnection Classes', () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
test('Create Data Channel', () => {
|
|
26
|
-
let peer = new nodeDataChannel.PeerConnection(
|
|
26
|
+
let peer = new nodeDataChannel.PeerConnection('Peer', { iceServers: ['stun:stun.l.google.com:19302'] });
|
|
27
27
|
let dc = peer.createDataChannel('test', { protocol: 'test-protocol' });
|
|
28
28
|
expect(dc).toBeDefined();
|
|
29
29
|
expect(dc.getId()).toBeDefined();
|
|
@@ -37,13 +37,12 @@ describe('PeerConnection Classes', () => {
|
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
|
|
41
40
|
describe('P2P', () => {
|
|
42
41
|
// Default is 5000 ms but we need more
|
|
43
42
|
jest.setTimeout(30000);
|
|
44
43
|
|
|
45
|
-
let peer1 = new nodeDataChannel.PeerConnection(
|
|
46
|
-
let peer2 = new nodeDataChannel.PeerConnection(
|
|
44
|
+
let peer1 = new nodeDataChannel.PeerConnection('Peer1', { iceServers: ['stun:stun.l.google.com:19302'] });
|
|
45
|
+
let peer2 = new nodeDataChannel.PeerConnection('Peer2', { iceServers: ['stun:stun.l.google.com:19302'] });
|
|
47
46
|
let dc1 = null;
|
|
48
47
|
let dc2 = null;
|
|
49
48
|
|
|
@@ -91,13 +90,13 @@ describe('P2P', () => {
|
|
|
91
90
|
dc2.onMessage((msg) => {
|
|
92
91
|
p2DCMessageMock(msg);
|
|
93
92
|
});
|
|
94
|
-
dc2.sendMessage(
|
|
93
|
+
dc2.sendMessage('Hello From Peer2');
|
|
95
94
|
});
|
|
96
95
|
|
|
97
|
-
dc1 = peer1.createDataChannel(
|
|
96
|
+
dc1 = peer1.createDataChannel('test-p2p');
|
|
98
97
|
dc1.onOpen(() => {
|
|
99
98
|
p1DCMock();
|
|
100
|
-
dc1.sendMessage(
|
|
99
|
+
dc1.sendMessage('Hello From Peer1');
|
|
101
100
|
});
|
|
102
101
|
dc1.onMessage((msg) => {
|
|
103
102
|
p1DCMessageMock(msg);
|
|
@@ -109,15 +108,6 @@ describe('P2P', () => {
|
|
|
109
108
|
dc2.close();
|
|
110
109
|
peer1.close();
|
|
111
110
|
peer2.close();
|
|
112
|
-
|
|
113
|
-
// Fee memory
|
|
114
|
-
dc1 = null;
|
|
115
|
-
dc2 = null;
|
|
116
|
-
peer1 = null;
|
|
117
|
-
peer2 = null;
|
|
118
|
-
|
|
119
|
-
// Cleanup Threads
|
|
120
|
-
nodeDataChannel.cleanup();
|
|
121
111
|
}, 10 * 1000);
|
|
122
112
|
|
|
123
113
|
setTimeout(() => {
|
|
@@ -138,15 +128,14 @@ describe('P2P', () => {
|
|
|
138
128
|
// DataChannel
|
|
139
129
|
expect(p1DCMock.mock.calls.length).toBe(1);
|
|
140
130
|
expect(p1DCMessageMock.mock.calls.length).toBe(1);
|
|
141
|
-
expect(p1DCMessageMock.mock.calls[0][0]).toEqual(
|
|
131
|
+
expect(p1DCMessageMock.mock.calls[0][0]).toEqual('Hello From Peer2');
|
|
142
132
|
expect(p2DCMock.mock.calls.length).toBe(1);
|
|
143
133
|
|
|
144
134
|
expect(p2DCMessageMock.mock.calls.length).toBe(1);
|
|
145
|
-
expect(p2DCMessageMock.mock.calls[0][0]).toEqual(
|
|
135
|
+
expect(p2DCMessageMock.mock.calls[0][0]).toEqual('Hello From Peer1');
|
|
146
136
|
|
|
147
137
|
done();
|
|
148
138
|
}, 12 * 1000);
|
|
149
|
-
|
|
150
139
|
});
|
|
151
140
|
});
|
|
152
141
|
|
|
@@ -161,14 +150,11 @@ function waitForGathering(peer) {
|
|
|
161
150
|
}
|
|
162
151
|
|
|
163
152
|
describe('DataChannel streams', () => {
|
|
164
|
-
|
|
165
153
|
test('can build an echo pipeline', async () => {
|
|
166
|
-
let clientPeer = new nodeDataChannel.PeerConnection(
|
|
167
|
-
let echoPeer = new nodeDataChannel.PeerConnection(
|
|
154
|
+
let clientPeer = new nodeDataChannel.PeerConnection('Client', { iceServers: [] });
|
|
155
|
+
let echoPeer = new nodeDataChannel.PeerConnection('Client', { iceServers: [] });
|
|
168
156
|
|
|
169
|
-
const echoStream = new nodeDataChannel.DataChannelStream(
|
|
170
|
-
echoPeer.createDataChannel("echo-channel")
|
|
171
|
-
);
|
|
157
|
+
const echoStream = new nodeDataChannel.DataChannelStream(echoPeer.createDataChannel('echo-channel'));
|
|
172
158
|
echoStream.pipe(echoStream); // Echo all received data back to the client
|
|
173
159
|
|
|
174
160
|
await waitForGathering(echoPeer);
|
|
@@ -183,11 +169,17 @@ describe('DataChannel streams', () => {
|
|
|
183
169
|
const clientChannel = await new Promise((resolve) => clientPeer.onDataChannel(resolve));
|
|
184
170
|
|
|
185
171
|
const clientResponsePromise = new Promise((resolve) => clientChannel.onMessage(resolve));
|
|
186
|
-
clientChannel.sendMessage(
|
|
172
|
+
clientChannel.sendMessage('test message');
|
|
187
173
|
|
|
188
|
-
expect(await clientResponsePromise).toBe(
|
|
174
|
+
expect(await clientResponsePromise).toBe('test message');
|
|
189
175
|
|
|
176
|
+
clientChannel.close();
|
|
190
177
|
clientPeer.close();
|
|
191
178
|
echoPeer.close();
|
|
192
179
|
});
|
|
193
|
-
});
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
afterAll(() => {
|
|
183
|
+
// Properly cleanup so Jest does not complain about asynchronous operations that weren't stopped.
|
|
184
|
+
nodeDataChannel.cleanup();
|
|
185
|
+
});
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# changes log
|
|
2
|
-
|
|
3
|
-
## 7.3.0
|
|
4
|
-
|
|
5
|
-
* Add `subset(r1, r2)` method to determine if `r1` range is entirely
|
|
6
|
-
contained by `r2` range.
|
|
7
|
-
|
|
8
|
-
## 7.2.3
|
|
9
|
-
|
|
10
|
-
* Fix handling of `includePrelease` mode where version ranges like `1.0.0 -
|
|
11
|
-
2.0.0` would include `3.0.0-pre` and not `1.0.0-pre`.
|
|
12
|
-
|
|
13
|
-
## 7.2.2
|
|
14
|
-
|
|
15
|
-
* Fix bug where `2.0.0-pre` would be included in `^1.0.0` if
|
|
16
|
-
`includePrerelease` was set to true.
|
|
17
|
-
|
|
18
|
-
## 7.2.0
|
|
19
|
-
|
|
20
|
-
* Add `simplifyRange` method to attempt to generate a more human-readable
|
|
21
|
-
range expression that is equivalent to a supplied range, for a given set
|
|
22
|
-
of versions.
|
|
23
|
-
|
|
24
|
-
## 7.1.2
|
|
25
|
-
|
|
26
|
-
* Remove fancy lazy-loading logic, as it was causing problems for webpack
|
|
27
|
-
users.
|
|
28
|
-
|
|
29
|
-
## 7.1.0
|
|
30
|
-
|
|
31
|
-
* Add `require('semver/preload')` to load the entire module without using
|
|
32
|
-
lazy getter methods.
|
|
33
|
-
|
|
34
|
-
## 7.0.0
|
|
35
|
-
|
|
36
|
-
* Refactor module into separate files for better tree-shaking
|
|
37
|
-
* Drop support for very old node versions, use const/let, `=>` functions,
|
|
38
|
-
and classes.
|
|
39
|
-
|
|
40
|
-
## 6.3.0
|
|
41
|
-
|
|
42
|
-
* Expose the token enum on the exports
|
|
43
|
-
|
|
44
|
-
## 6.2.0
|
|
45
|
-
|
|
46
|
-
* Coerce numbers to strings when passed to semver.coerce()
|
|
47
|
-
* Add `rtl` option to coerce from right to left
|
|
48
|
-
|
|
49
|
-
## 6.1.3
|
|
50
|
-
|
|
51
|
-
* Handle X-ranges properly in includePrerelease mode
|
|
52
|
-
|
|
53
|
-
## 6.1.2
|
|
54
|
-
|
|
55
|
-
* Do not throw when testing invalid version strings
|
|
56
|
-
|
|
57
|
-
## 6.1.1
|
|
58
|
-
|
|
59
|
-
* Add options support for semver.coerce()
|
|
60
|
-
* Handle undefined version passed to Range.test
|
|
61
|
-
|
|
62
|
-
## 6.1.0
|
|
63
|
-
|
|
64
|
-
* Add semver.compareBuild function
|
|
65
|
-
* Support `*` in semver.intersects
|
|
66
|
-
|
|
67
|
-
## 6.0
|
|
68
|
-
|
|
69
|
-
* Fix `intersects` logic.
|
|
70
|
-
|
|
71
|
-
This is technically a bug fix, but since it is also a change to behavior
|
|
72
|
-
that may require users updating their code, it is marked as a major
|
|
73
|
-
version increment.
|
|
74
|
-
|
|
75
|
-
## 5.7
|
|
76
|
-
|
|
77
|
-
* Add `minVersion` method
|
|
78
|
-
|
|
79
|
-
## 5.6
|
|
80
|
-
|
|
81
|
-
* Move boolean `loose` param to an options object, with
|
|
82
|
-
backwards-compatibility protection.
|
|
83
|
-
* Add ability to opt out of special prerelease version handling with
|
|
84
|
-
the `includePrerelease` option flag.
|
|
85
|
-
|
|
86
|
-
## 5.5
|
|
87
|
-
|
|
88
|
-
* Add version coercion capabilities
|
|
89
|
-
|
|
90
|
-
## 5.4
|
|
91
|
-
|
|
92
|
-
* Add intersection checking
|
|
93
|
-
|
|
94
|
-
## 5.3
|
|
95
|
-
|
|
96
|
-
* Add `minSatisfying` method
|
|
97
|
-
|
|
98
|
-
## 5.2
|
|
99
|
-
|
|
100
|
-
* Add `prerelease(v)` that returns prerelease components
|
|
101
|
-
|
|
102
|
-
## 5.1
|
|
103
|
-
|
|
104
|
-
* Add Backus-Naur for ranges
|
|
105
|
-
* Remove excessively cute inspection methods
|
|
106
|
-
|
|
107
|
-
## 5.0
|
|
108
|
-
|
|
109
|
-
* Remove AMD/Browserified build artifacts
|
|
110
|
-
* Fix ltr and gtr when using the `*` range
|
|
111
|
-
* Fix for range `*` with a prerelease identifier
|