node-datachannel 0.3.0 → 0.3.3
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/build-linux.yml +1 -1
- package/.github/workflows/build-mac.yml +1 -1
- package/.github/workflows/build-win.yml +1 -1
- package/.github/workflows/lint.yml +19 -0
- package/CMakeLists.txt +3 -3
- package/README.md +2 -0
- 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 +102 -101
- 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 +111 -71
- 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
|
@@ -1,26 +1,192 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "client",
|
|
3
3
|
"version": "1.0.0",
|
|
4
|
-
"lockfileVersion":
|
|
4
|
+
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"": {
|
|
8
|
+
"name": "client",
|
|
9
|
+
"version": "1.0.0",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"ws": "^7.5.3",
|
|
13
|
+
"yargs": "^16.2.0"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"node_modules/ansi-regex": {
|
|
17
|
+
"version": "5.0.0",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=8"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"node_modules/ansi-styles": {
|
|
24
|
+
"version": "4.3.0",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"color-convert": "^2.0.1"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=8"
|
|
31
|
+
},
|
|
32
|
+
"funding": {
|
|
33
|
+
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"node_modules/cliui": {
|
|
37
|
+
"version": "7.0.4",
|
|
38
|
+
"license": "ISC",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"string-width": "^4.2.0",
|
|
41
|
+
"strip-ansi": "^6.0.0",
|
|
42
|
+
"wrap-ansi": "^7.0.0"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"node_modules/color-convert": {
|
|
46
|
+
"version": "2.0.1",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"color-name": "~1.1.4"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=7.0.0"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"node_modules/color-name": {
|
|
56
|
+
"version": "1.1.4",
|
|
57
|
+
"license": "MIT"
|
|
58
|
+
},
|
|
59
|
+
"node_modules/emoji-regex": {
|
|
60
|
+
"version": "8.0.0",
|
|
61
|
+
"license": "MIT"
|
|
62
|
+
},
|
|
63
|
+
"node_modules/escalade": {
|
|
64
|
+
"version": "3.1.1",
|
|
65
|
+
"license": "MIT",
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=6"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"node_modules/get-caller-file": {
|
|
71
|
+
"version": "2.0.5",
|
|
72
|
+
"license": "ISC",
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": "6.* || 8.* || >= 10.*"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"node_modules/is-fullwidth-code-point": {
|
|
78
|
+
"version": "3.0.0",
|
|
79
|
+
"license": "MIT",
|
|
80
|
+
"engines": {
|
|
81
|
+
"node": ">=8"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"node_modules/require-directory": {
|
|
85
|
+
"version": "2.1.1",
|
|
86
|
+
"license": "MIT",
|
|
87
|
+
"engines": {
|
|
88
|
+
"node": ">=0.10.0"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"node_modules/string-width": {
|
|
92
|
+
"version": "4.2.2",
|
|
93
|
+
"license": "MIT",
|
|
94
|
+
"dependencies": {
|
|
95
|
+
"emoji-regex": "^8.0.0",
|
|
96
|
+
"is-fullwidth-code-point": "^3.0.0",
|
|
97
|
+
"strip-ansi": "^6.0.0"
|
|
98
|
+
},
|
|
99
|
+
"engines": {
|
|
100
|
+
"node": ">=8"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"node_modules/strip-ansi": {
|
|
104
|
+
"version": "6.0.0",
|
|
105
|
+
"license": "MIT",
|
|
106
|
+
"dependencies": {
|
|
107
|
+
"ansi-regex": "^5.0.0"
|
|
108
|
+
},
|
|
109
|
+
"engines": {
|
|
110
|
+
"node": ">=8"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"node_modules/wrap-ansi": {
|
|
114
|
+
"version": "7.0.0",
|
|
115
|
+
"license": "MIT",
|
|
116
|
+
"dependencies": {
|
|
117
|
+
"ansi-styles": "^4.0.0",
|
|
118
|
+
"string-width": "^4.1.0",
|
|
119
|
+
"strip-ansi": "^6.0.0"
|
|
120
|
+
},
|
|
121
|
+
"engines": {
|
|
122
|
+
"node": ">=10"
|
|
123
|
+
},
|
|
124
|
+
"funding": {
|
|
125
|
+
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"node_modules/ws": {
|
|
129
|
+
"version": "7.5.3",
|
|
130
|
+
"license": "MIT",
|
|
131
|
+
"engines": {
|
|
132
|
+
"node": ">=8.3.0"
|
|
133
|
+
},
|
|
134
|
+
"peerDependencies": {
|
|
135
|
+
"bufferutil": "^4.0.1",
|
|
136
|
+
"utf-8-validate": "^5.0.2"
|
|
137
|
+
},
|
|
138
|
+
"peerDependenciesMeta": {
|
|
139
|
+
"bufferutil": {
|
|
140
|
+
"optional": true
|
|
141
|
+
},
|
|
142
|
+
"utf-8-validate": {
|
|
143
|
+
"optional": true
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"node_modules/y18n": {
|
|
148
|
+
"version": "5.0.8",
|
|
149
|
+
"license": "ISC",
|
|
150
|
+
"engines": {
|
|
151
|
+
"node": ">=10"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"node_modules/yargs": {
|
|
155
|
+
"version": "16.2.0",
|
|
156
|
+
"license": "MIT",
|
|
157
|
+
"dependencies": {
|
|
158
|
+
"cliui": "^7.0.2",
|
|
159
|
+
"escalade": "^3.1.1",
|
|
160
|
+
"get-caller-file": "^2.0.5",
|
|
161
|
+
"require-directory": "^2.1.1",
|
|
162
|
+
"string-width": "^4.2.0",
|
|
163
|
+
"y18n": "^5.0.5",
|
|
164
|
+
"yargs-parser": "^20.2.2"
|
|
165
|
+
},
|
|
166
|
+
"engines": {
|
|
167
|
+
"node": ">=10"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"node_modules/yargs-parser": {
|
|
171
|
+
"version": "20.2.7",
|
|
172
|
+
"license": "ISC",
|
|
173
|
+
"engines": {
|
|
174
|
+
"node": ">=10"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
6
178
|
"dependencies": {
|
|
7
179
|
"ansi-regex": {
|
|
8
|
-
"version": "5.0.0"
|
|
9
|
-
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
|
10
|
-
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
|
|
180
|
+
"version": "5.0.0"
|
|
11
181
|
},
|
|
12
182
|
"ansi-styles": {
|
|
13
183
|
"version": "4.3.0",
|
|
14
|
-
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
|
15
|
-
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
|
16
184
|
"requires": {
|
|
17
185
|
"color-convert": "^2.0.1"
|
|
18
186
|
}
|
|
19
187
|
},
|
|
20
188
|
"cliui": {
|
|
21
189
|
"version": "7.0.4",
|
|
22
|
-
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
|
|
23
|
-
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
|
|
24
190
|
"requires": {
|
|
25
191
|
"string-width": "^4.2.0",
|
|
26
192
|
"strip-ansi": "^6.0.0",
|
|
@@ -29,46 +195,30 @@
|
|
|
29
195
|
},
|
|
30
196
|
"color-convert": {
|
|
31
197
|
"version": "2.0.1",
|
|
32
|
-
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
|
33
|
-
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
|
34
198
|
"requires": {
|
|
35
199
|
"color-name": "~1.1.4"
|
|
36
200
|
}
|
|
37
201
|
},
|
|
38
202
|
"color-name": {
|
|
39
|
-
"version": "1.1.4"
|
|
40
|
-
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
|
41
|
-
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
|
203
|
+
"version": "1.1.4"
|
|
42
204
|
},
|
|
43
205
|
"emoji-regex": {
|
|
44
|
-
"version": "8.0.0"
|
|
45
|
-
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
|
46
|
-
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
|
|
206
|
+
"version": "8.0.0"
|
|
47
207
|
},
|
|
48
208
|
"escalade": {
|
|
49
|
-
"version": "3.1.1"
|
|
50
|
-
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
|
|
51
|
-
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw=="
|
|
209
|
+
"version": "3.1.1"
|
|
52
210
|
},
|
|
53
211
|
"get-caller-file": {
|
|
54
|
-
"version": "2.0.5"
|
|
55
|
-
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
|
56
|
-
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
|
|
212
|
+
"version": "2.0.5"
|
|
57
213
|
},
|
|
58
214
|
"is-fullwidth-code-point": {
|
|
59
|
-
"version": "3.0.0"
|
|
60
|
-
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
|
61
|
-
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
|
|
215
|
+
"version": "3.0.0"
|
|
62
216
|
},
|
|
63
217
|
"require-directory": {
|
|
64
|
-
"version": "2.1.1"
|
|
65
|
-
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
|
66
|
-
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
|
|
218
|
+
"version": "2.1.1"
|
|
67
219
|
},
|
|
68
220
|
"string-width": {
|
|
69
221
|
"version": "4.2.2",
|
|
70
|
-
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz",
|
|
71
|
-
"integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==",
|
|
72
222
|
"requires": {
|
|
73
223
|
"emoji-regex": "^8.0.0",
|
|
74
224
|
"is-fullwidth-code-point": "^3.0.0",
|
|
@@ -77,16 +227,12 @@
|
|
|
77
227
|
},
|
|
78
228
|
"strip-ansi": {
|
|
79
229
|
"version": "6.0.0",
|
|
80
|
-
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
|
|
81
|
-
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
|
|
82
230
|
"requires": {
|
|
83
231
|
"ansi-regex": "^5.0.0"
|
|
84
232
|
}
|
|
85
233
|
},
|
|
86
234
|
"wrap-ansi": {
|
|
87
235
|
"version": "7.0.0",
|
|
88
|
-
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
|
89
|
-
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
|
90
236
|
"requires": {
|
|
91
237
|
"ansi-styles": "^4.0.0",
|
|
92
238
|
"string-width": "^4.1.0",
|
|
@@ -95,18 +241,13 @@
|
|
|
95
241
|
},
|
|
96
242
|
"ws": {
|
|
97
243
|
"version": "7.5.3",
|
|
98
|
-
"
|
|
99
|
-
"integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg=="
|
|
244
|
+
"requires": {}
|
|
100
245
|
},
|
|
101
246
|
"y18n": {
|
|
102
|
-
"version": "5.0.8"
|
|
103
|
-
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
|
104
|
-
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="
|
|
247
|
+
"version": "5.0.8"
|
|
105
248
|
},
|
|
106
249
|
"yargs": {
|
|
107
250
|
"version": "16.2.0",
|
|
108
|
-
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
|
|
109
|
-
"integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
|
|
110
251
|
"requires": {
|
|
111
252
|
"cliui": "^7.0.2",
|
|
112
253
|
"escalade": "^3.1.1",
|
|
@@ -118,9 +259,7 @@
|
|
|
118
259
|
}
|
|
119
260
|
},
|
|
120
261
|
"yargs-parser": {
|
|
121
|
-
"version": "20.2.7"
|
|
122
|
-
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz",
|
|
123
|
-
"integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw=="
|
|
262
|
+
"version": "20.2.7"
|
|
124
263
|
}
|
|
125
264
|
}
|
|
126
265
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
1
2
|
const WebSocket = require('ws');
|
|
2
3
|
|
|
3
4
|
const clients = {};
|
|
@@ -5,7 +6,7 @@ const clients = {};
|
|
|
5
6
|
const wss = new WebSocket.Server({ port: 8000 });
|
|
6
7
|
|
|
7
8
|
wss.on('connection', (ws, req) => {
|
|
8
|
-
const id = req.url.replace('/', '')
|
|
9
|
+
const id = req.url.replace('/', '');
|
|
9
10
|
console.log(`New Connection from ${id}`);
|
|
10
11
|
|
|
11
12
|
clients[id] = ws;
|
|
@@ -15,12 +16,10 @@ wss.on('connection', (ws, req) => {
|
|
|
15
16
|
let peerWs = clients[peerId];
|
|
16
17
|
|
|
17
18
|
console.log(`Message from ${id} to ${peerId} : ${buffer}`);
|
|
18
|
-
if (!peerWs)
|
|
19
|
-
return console.error(`Can not find peer with ID ${peerId}`);
|
|
19
|
+
if (!peerWs) return console.error(`Can not find peer with ID ${peerId}`);
|
|
20
20
|
|
|
21
21
|
msg.id = id;
|
|
22
22
|
peerWs.send(JSON.stringify(msg));
|
|
23
|
-
|
|
24
23
|
});
|
|
25
24
|
|
|
26
25
|
ws.on('close', () => {
|
|
@@ -28,4 +27,3 @@ wss.on('connection', (ws, req) => {
|
|
|
28
27
|
delete clients[id];
|
|
29
28
|
});
|
|
30
29
|
});
|
|
31
|
-
|
package/examples/media/media.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
1
2
|
const nodeDataChannel = require('../../lib/index');
|
|
2
|
-
const readline = require(
|
|
3
|
+
const readline = require('readline');
|
|
3
4
|
var dgram = require('dgram');
|
|
4
5
|
|
|
5
6
|
var client = dgram.createSocket('udp4');
|
|
@@ -7,7 +8,7 @@ var client = dgram.createSocket('udp4');
|
|
|
7
8
|
// Read Line Interface
|
|
8
9
|
const rl = readline.createInterface({
|
|
9
10
|
input: process.stdin,
|
|
10
|
-
output: process.stdout
|
|
11
|
+
output: process.stdout,
|
|
11
12
|
});
|
|
12
13
|
|
|
13
14
|
// Init Logger
|
|
@@ -21,7 +22,7 @@ peerConnection.onStateChange((state) => {
|
|
|
21
22
|
peerConnection.onGatheringStateChange((state) => {
|
|
22
23
|
// console.log('GatheringState: ', state);
|
|
23
24
|
|
|
24
|
-
if(state == 'complete'){
|
|
25
|
+
if (state == 'complete') {
|
|
25
26
|
let desc = peerConnection.localDescription();
|
|
26
27
|
console.log('');
|
|
27
28
|
console.log('## Please copy the offer below to the web page:');
|
|
@@ -31,14 +32,13 @@ peerConnection.onGatheringStateChange((state) => {
|
|
|
31
32
|
rl.question('## Please copy/paste the answer provided by the browser: \n', (sdp) => {
|
|
32
33
|
let sdpObj = JSON.parse(sdp);
|
|
33
34
|
peerConnection.setRemoteDescription(sdpObj.sdp, sdpObj.type);
|
|
34
|
-
console.log(track.isOpen())
|
|
35
|
+
console.log(track.isOpen());
|
|
35
36
|
rl.close();
|
|
36
|
-
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
let video = new nodeDataChannel.Video('video','RecvOnly');
|
|
41
|
+
let video = new nodeDataChannel.Video('video', 'RecvOnly');
|
|
42
42
|
video.addH264Codec(96);
|
|
43
43
|
video.setBitrate(3000);
|
|
44
44
|
|
|
@@ -46,9 +46,9 @@ let track = peerConnection.addTrack(video);
|
|
|
46
46
|
let session = new nodeDataChannel.RtcpReceivingSession();
|
|
47
47
|
|
|
48
48
|
track.setMediaHandler(session);
|
|
49
|
-
track.onMessage((msg)=>{
|
|
50
|
-
client.send(msg,5000,'127.0.0.1',(err,n)=>{
|
|
51
|
-
if(err) console.log(err,n);
|
|
49
|
+
track.onMessage((msg) => {
|
|
50
|
+
client.send(msg, 5000, '127.0.0.1', (err, n) => {
|
|
51
|
+
if (err) console.log(err, n);
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
54
|
|
package/lib/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export function cleanup(): void;
|
|
|
22
22
|
export function setSctpSettings(settings: SctpSettings): void;
|
|
23
23
|
|
|
24
24
|
// Proxy Server
|
|
25
|
-
export type ProxyServerType = '
|
|
25
|
+
export type ProxyServerType = 'Socks5' | 'Http';
|
|
26
26
|
export interface ProxyServer {
|
|
27
27
|
type: ProxyServerType;
|
|
28
28
|
ip: string;
|
|
@@ -53,6 +53,7 @@ export interface RtcConfig {
|
|
|
53
53
|
portRangeBegin?: number;
|
|
54
54
|
portRangeEnd?: number;
|
|
55
55
|
maxMessageSize?: number;
|
|
56
|
+
mtu?: number;
|
|
56
57
|
iceTransportPolicy?: TransportPolicy;
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -103,124 +104,124 @@ export const enum Direction {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
export class RtcpReceivingSession {
|
|
106
|
-
requestBitrate
|
|
107
|
-
requestKeyframe
|
|
107
|
+
requestBitrate(bitRate: number): void;
|
|
108
|
+
requestKeyframe(): boolean;
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
export class Audio {
|
|
111
112
|
constructor(mid: string, dir: Direction);
|
|
112
|
-
addAudioCodec
|
|
113
|
-
addOpusCodec
|
|
114
|
-
|
|
115
|
-
direction
|
|
116
|
-
generateSdp
|
|
117
|
-
mid
|
|
118
|
-
setDirection
|
|
119
|
-
description
|
|
120
|
-
removeFormat
|
|
121
|
-
addSSRC
|
|
122
|
-
removeSSRC
|
|
123
|
-
replaceSSRC
|
|
124
|
-
hasSSRC
|
|
125
|
-
getSSRCs
|
|
126
|
-
getCNameForSsrc
|
|
127
|
-
setBitrate
|
|
128
|
-
getBitrate
|
|
129
|
-
hasPayloadType
|
|
130
|
-
addRTXCodec
|
|
131
|
-
addRTPMap
|
|
132
|
-
parseSdpLine
|
|
113
|
+
addAudioCodec(payloadType: number, codec: string, profile?: string): void;
|
|
114
|
+
addOpusCodec(payloadType: number, profile?: string): string;
|
|
115
|
+
|
|
116
|
+
direction(): Direction;
|
|
117
|
+
generateSdp(eol: string, addr: string, port: number): string;
|
|
118
|
+
mid(): string;
|
|
119
|
+
setDirection(dir: Direction): void;
|
|
120
|
+
description(): string;
|
|
121
|
+
removeFormat(fmt: string): void;
|
|
122
|
+
addSSRC(ssrc: number, name?: string, msid?: string, trackID?: string): void;
|
|
123
|
+
removeSSRC(ssrc: number): void;
|
|
124
|
+
replaceSSRC(oldSsrc: number, ssrc: number, name?: string, msid?: string, trackID?: string): void;
|
|
125
|
+
hasSSRC(ssrc: number): boolean;
|
|
126
|
+
getSSRCs(): number[];
|
|
127
|
+
getCNameForSsrc(ssrc: number): string;
|
|
128
|
+
setBitrate(bitRate: number): void;
|
|
129
|
+
getBitrate(): number;
|
|
130
|
+
hasPayloadType(payloadType: number): boolean;
|
|
131
|
+
addRTXCodec(payloadType: number, originalPayloadType: number, clockRate: number): void;
|
|
132
|
+
addRTPMap(): void;
|
|
133
|
+
parseSdpLine(line: string): void;
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
export class Video {
|
|
136
137
|
constructor(mid: string, dir: Direction);
|
|
137
|
-
addVideoCodec
|
|
138
|
-
addH264Codec
|
|
139
|
-
addVP8Codec
|
|
140
|
-
addVP9Codec
|
|
141
|
-
|
|
142
|
-
direction
|
|
143
|
-
generateSdp
|
|
144
|
-
mid
|
|
145
|
-
setDirection
|
|
146
|
-
description
|
|
147
|
-
removeFormat
|
|
148
|
-
addSSRC
|
|
149
|
-
removeSSRC
|
|
150
|
-
replaceSSRC
|
|
151
|
-
hasSSRC
|
|
152
|
-
getSSRCs
|
|
153
|
-
getCNameForSsrc
|
|
154
|
-
setBitrate
|
|
155
|
-
getBitrate
|
|
156
|
-
hasPayloadType
|
|
157
|
-
addRTXCodec
|
|
158
|
-
addRTPMap
|
|
159
|
-
parseSdpLine
|
|
138
|
+
addVideoCodec(payloadType: number, codec: string, profile?: string): void;
|
|
139
|
+
addH264Codec(payloadType: number, profile?: string): void;
|
|
140
|
+
addVP8Codec(payloadType: number): void;
|
|
141
|
+
addVP9Codec(payloadType: number): void;
|
|
142
|
+
|
|
143
|
+
direction(): Direction;
|
|
144
|
+
generateSdp(eol: string, addr: string, port: number): string;
|
|
145
|
+
mid(): string;
|
|
146
|
+
setDirection(dir: Direction): void;
|
|
147
|
+
description(): string;
|
|
148
|
+
removeFormat(fmt: string): void;
|
|
149
|
+
addSSRC(ssrc: number, name?: string, msid?: string, trackID?: string): void;
|
|
150
|
+
removeSSRC(ssrc: number): void;
|
|
151
|
+
replaceSSRC(oldSsrc: number, ssrc: number, name?: string, msid?: string, trackID?: string): void;
|
|
152
|
+
hasSSRC(ssrc: number): boolean;
|
|
153
|
+
getSSRCs(): number[];
|
|
154
|
+
getCNameForSsrc(ssrc: number): string;
|
|
155
|
+
setBitrate(bitRate: number): void;
|
|
156
|
+
getBitrate(): number;
|
|
157
|
+
hasPayloadType(payloadType: number): boolean;
|
|
158
|
+
addRTXCodec(payloadType: number, originalPayloadType: number, clockRate: number): void;
|
|
159
|
+
addRTPMap(): void;
|
|
160
|
+
parseSdpLine(line: string): void;
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
export class Track {
|
|
163
|
-
direction
|
|
164
|
-
mid
|
|
165
|
-
type
|
|
166
|
-
close
|
|
167
|
-
sendMessage
|
|
168
|
-
sendMessageBinary
|
|
169
|
-
isOpen
|
|
170
|
-
isClosed
|
|
171
|
-
bufferedAmount
|
|
172
|
-
maxMessageSize
|
|
173
|
-
setBufferedAmountLowThreshold
|
|
174
|
-
requestKeyframe
|
|
175
|
-
setMediaHandler
|
|
176
|
-
onOpen
|
|
177
|
-
onClosed
|
|
178
|
-
onError
|
|
179
|
-
onMessage
|
|
164
|
+
direction(): Direction;
|
|
165
|
+
mid(): string;
|
|
166
|
+
type(): string;
|
|
167
|
+
close(): void;
|
|
168
|
+
sendMessage(msg: string): boolean;
|
|
169
|
+
sendMessageBinary(buffer: Buffer): boolean;
|
|
170
|
+
isOpen(): boolean;
|
|
171
|
+
isClosed(): boolean;
|
|
172
|
+
bufferedAmount(): number;
|
|
173
|
+
maxMessageSize(): number;
|
|
174
|
+
setBufferedAmountLowThreshold(newSize: number): void;
|
|
175
|
+
requestKeyframe(): boolean;
|
|
176
|
+
setMediaHandler(handler: RtcpReceivingSession): void;
|
|
177
|
+
onOpen(cb: () => void): void;
|
|
178
|
+
onClosed(cb: () => void): void;
|
|
179
|
+
onError(cb: (err: string) => void): void;
|
|
180
|
+
onMessage(cb: (msg: Buffer) => void): void;
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
export class DataChannel {
|
|
183
|
-
close
|
|
184
|
-
getLabel
|
|
185
|
-
getId
|
|
186
|
-
getProtocol
|
|
187
|
-
sendMessage
|
|
188
|
-
sendMessageBinary
|
|
189
|
-
isOpen
|
|
190
|
-
bufferedAmount
|
|
191
|
-
maxMessageSize
|
|
192
|
-
setBufferedAmountLowThreshold
|
|
193
|
-
onOpen
|
|
194
|
-
onClosed
|
|
195
|
-
onError
|
|
196
|
-
onBufferedAmountLow
|
|
197
|
-
onMessage
|
|
184
|
+
close(): void;
|
|
185
|
+
getLabel(): string;
|
|
186
|
+
getId(): number;
|
|
187
|
+
getProtocol(): string;
|
|
188
|
+
sendMessage(msg: string): boolean;
|
|
189
|
+
sendMessageBinary(buffer: Buffer): boolean;
|
|
190
|
+
isOpen(): boolean;
|
|
191
|
+
bufferedAmount(): number;
|
|
192
|
+
maxMessageSize(): number;
|
|
193
|
+
setBufferedAmountLowThreshold(newSize: number): void;
|
|
194
|
+
onOpen(cb: () => void): void;
|
|
195
|
+
onClosed(cb: () => void): void;
|
|
196
|
+
onError(cb: (err: string) => void): void;
|
|
197
|
+
onBufferedAmountLow(cb: () => void): void;
|
|
198
|
+
onMessage(cb: (msg: string | Buffer) => void): void;
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
export class PeerConnection {
|
|
201
202
|
constructor(peerName: string, config: RtcConfig);
|
|
202
|
-
close
|
|
203
|
-
setLocalDescription
|
|
204
|
-
setRemoteDescription
|
|
205
|
-
localDescription
|
|
206
|
-
addRemoteCandidate
|
|
207
|
-
createDataChannel
|
|
208
|
-
addTrack
|
|
209
|
-
hasMedia
|
|
210
|
-
state
|
|
211
|
-
signalingState
|
|
212
|
-
gatheringState
|
|
213
|
-
onLocalDescription
|
|
214
|
-
onLocalCandidate
|
|
215
|
-
onStateChange
|
|
216
|
-
onSignalingStateChange: (state:
|
|
217
|
-
onGatheringStateChange: (state:
|
|
218
|
-
onDataChannel
|
|
219
|
-
onTrack
|
|
220
|
-
bytesSent
|
|
221
|
-
bytesReceived
|
|
222
|
-
rtt
|
|
223
|
-
getSelectedCandidatePair
|
|
203
|
+
close(): void;
|
|
204
|
+
setLocalDescription(type?: DescriptionType): void;
|
|
205
|
+
setRemoteDescription(sdp: string, type: DescriptionType): void;
|
|
206
|
+
localDescription(): { type: string; sdp: string } | null;
|
|
207
|
+
addRemoteCandidate(candidate: string, mid: string): void;
|
|
208
|
+
createDataChannel(label: string, config?: DataChannelInitConfig): DataChannel;
|
|
209
|
+
addTrack(media: Video | Audio): Track;
|
|
210
|
+
hasMedia(): boolean;
|
|
211
|
+
state(): string;
|
|
212
|
+
signalingState(): string;
|
|
213
|
+
gatheringState(): string;
|
|
214
|
+
onLocalDescription(cb: (sdp: string, type: DescriptionType) => void): void;
|
|
215
|
+
onLocalCandidate(cb: (candidate: string, mid: string) => void): void;
|
|
216
|
+
onStateChange(cb: (state: string) => void): void;
|
|
217
|
+
onSignalingStateChange(cb: (state: string) => void): void;
|
|
218
|
+
onGatheringStateChange(cb: (state: string) => void): void;
|
|
219
|
+
onDataChannel(cb: (dc: DataChannel) => void): void;
|
|
220
|
+
onTrack(cb: (track: Track) => void): void;
|
|
221
|
+
bytesSent(): number;
|
|
222
|
+
bytesReceived(): number;
|
|
223
|
+
rtt(): number;
|
|
224
|
+
getSelectedCandidatePair(): { local: SelectedCandidateInfo; remote: SelectedCandidateInfo } | null;
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
export class DataChannelStream extends stream.Duplex {
|
|
@@ -22,10 +22,8 @@
|
|
|
22
22
|
"fetchSpec": "6.0.0"
|
|
23
23
|
},
|
|
24
24
|
"_requiredBy": [
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"/jest-snapshot/semver",
|
|
28
|
-
"/node-abi/semver"
|
|
25
|
+
"/node-abi/semver",
|
|
26
|
+
"/semver"
|
|
29
27
|
],
|
|
30
28
|
"_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
|
31
29
|
"_spec": "6.0.0",
|
|
@@ -264,7 +264,9 @@ provided tuple parts.
|
|
|
264
264
|
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
|
|
265
265
|
numeric values in the `[major, minor, patch]` tuple.
|
|
266
266
|
|
|
267
|
-
* `*` := `>=0.0.0` (Any version satisfies
|
|
267
|
+
* `*` := `>=0.0.0` (Any non-prerelease version satisfies, unless
|
|
268
|
+
`includePrerelease` is specified, in which case any version at all
|
|
269
|
+
satisfies)
|
|
268
270
|
* `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version)
|
|
269
271
|
* `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions)
|
|
270
272
|
|