node-datachannel 0.10.0 → 0.10.1
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-mac-m1.yml +7 -6
- package/.github/workflows/build-mac-x64.yml +5 -5
- package/CMakeLists.txt +2 -2
- package/README.md +19 -31
- package/package.json +1 -1
- package/polyfill/README.md +0 -4
|
@@ -6,25 +6,26 @@ on:
|
|
|
6
6
|
# tags:
|
|
7
7
|
# - v*
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
env:
|
|
10
11
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
11
12
|
|
|
12
13
|
jobs:
|
|
13
14
|
build-macos:
|
|
14
|
-
runs-on: macos-
|
|
15
|
+
runs-on: macos-13
|
|
15
16
|
strategy:
|
|
16
17
|
matrix:
|
|
17
18
|
node-version: [16.x]
|
|
18
19
|
|
|
19
20
|
steps:
|
|
20
|
-
- uses: actions/checkout@
|
|
21
|
+
- uses: actions/checkout@v4
|
|
21
22
|
- name: Install OpenSSL
|
|
22
23
|
run: |
|
|
23
|
-
wget https://mac.r-project.org/bin/darwin20/arm64/openssl-1.1.
|
|
24
|
-
tar -xf openssl-1.1.
|
|
25
|
-
rm -rf openssl-1.1.
|
|
24
|
+
wget https://mac.r-project.org/bin/darwin20/arm64/openssl-1.1.1t-darwin.20-arm64.tar.xz
|
|
25
|
+
tar -xf openssl-1.1.1t-darwin.20-arm64.tar.xz -C /tmp
|
|
26
|
+
rm -rf openssl-1.1.1t-darwin.20-arm64.tar.xz
|
|
26
27
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
27
|
-
uses: actions/setup-node@
|
|
28
|
+
uses: actions/setup-node@v4
|
|
28
29
|
with:
|
|
29
30
|
node-version: ${{ matrix.node-version }}
|
|
30
31
|
- name: Build
|
|
@@ -11,25 +11,25 @@ env:
|
|
|
11
11
|
|
|
12
12
|
jobs:
|
|
13
13
|
build-macos:
|
|
14
|
-
runs-on: macos-
|
|
14
|
+
runs-on: macos-13
|
|
15
15
|
strategy:
|
|
16
16
|
matrix:
|
|
17
17
|
node-version: [16.x]
|
|
18
18
|
|
|
19
19
|
steps:
|
|
20
|
-
- uses: actions/checkout@
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
21
|
- name: Install OpenSSL
|
|
22
22
|
run: HOMEBREW_NO_INSTALL_CLEANUP=1 brew reinstall openssl@1.1
|
|
23
23
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
24
|
-
uses: actions/setup-node@
|
|
24
|
+
uses: actions/setup-node@v4
|
|
25
25
|
with:
|
|
26
26
|
node-version: ${{ matrix.node-version }}
|
|
27
27
|
- name: Build
|
|
28
28
|
run: npm install --build-from-source
|
|
29
29
|
env:
|
|
30
30
|
CI: true
|
|
31
|
-
OPENSSL_ROOT_DIR: /usr/local/opt/openssl
|
|
32
|
-
OPENSSL_LIBRARIES: /usr/local/opt/openssl/lib
|
|
31
|
+
OPENSSL_ROOT_DIR: /usr/local/opt/openssl@1.1
|
|
32
|
+
OPENSSL_LIBRARIES: /usr/local/opt/openssl@1.1/lib
|
|
33
33
|
- name: Test
|
|
34
34
|
run: npm run test
|
|
35
35
|
env:
|
package/CMakeLists.txt
CHANGED
|
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)
|
|
|
2
2
|
cmake_policy(SET CMP0091 NEW)
|
|
3
3
|
cmake_policy(SET CMP0042 NEW)
|
|
4
4
|
|
|
5
|
-
project(node_datachannel VERSION 0.10.
|
|
5
|
+
project(node_datachannel VERSION 0.10.1)
|
|
6
6
|
|
|
7
7
|
# -Dnapi_build_version=8
|
|
8
8
|
add_definitions(-DNAPI_VERSION=8)
|
|
@@ -29,7 +29,7 @@ include(FetchContent)
|
|
|
29
29
|
FetchContent_Declare(
|
|
30
30
|
libdatachannel
|
|
31
31
|
GIT_REPOSITORY https://github.com/paullouisageneau/libdatachannel.git
|
|
32
|
-
GIT_TAG "v0.21.
|
|
32
|
+
GIT_TAG "v0.21.2"
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
option(NO_MEDIA "Disable media transport support in libdatachannel" OFF)
|
package/README.md
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# WebRTC For Node.js and Electron
|
|
2
2
|
|
|
3
3
|
   
|
|
4
4
|
|
|
5
|
-
- Easy to use
|
|
6
5
|
- Lightweight
|
|
7
6
|
- No need to deal with WebRTC stack!
|
|
8
|
-
- Small binary sizes
|
|
7
|
+
- Small binary sizes (~8MB for Linux X64)
|
|
9
8
|
- Type infos for Typescript
|
|
10
9
|
|
|
11
|
-
This project is
|
|
12
|
-
|
|
13
|
-
Please check [libdatachannel](https://github.com/paullouisageneau/libdatachannel) for Compatibility & WebRTC details.
|
|
10
|
+
This project is Node.js bindings for [libdatachannel](https://github.com/paullouisageneau/libdatachannel) library.
|
|
14
11
|
|
|
15
12
|
## Install
|
|
16
13
|
|
|
@@ -20,11 +17,11 @@ npm install node-datachannel
|
|
|
20
17
|
|
|
21
18
|
## Supported Platforms
|
|
22
19
|
|
|
23
|
-
`node-datachannel` targets N-API version 8 and supports
|
|
20
|
+
`node-datachannel` targets N-API version 8 and supports Node.js v16 and above. It is tested on Linux, Windows and MacOS. For N-API compatibility please check [here](https://nodejs.org/api/n-api.html#n_api_n_api_version_matrix).
|
|
24
21
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
22
|
+
| | Linux [x64,armv7,arm64] (1) | Windows [x86,x64] | Mac [M1,x64] |
|
|
23
|
+
| ------------------------- | :-------------------------: | :---------------: | :----------: |
|
|
24
|
+
| N-API v8 (>= Node.js v16) | + | + | + |
|
|
28
25
|
|
|
29
26
|
**(1)** For Linux musl + libc
|
|
30
27
|
|
|
@@ -34,6 +31,12 @@ npm install node-datachannel
|
|
|
34
31
|
|
|
35
32
|
Please check [electron demo](/examples/electron-demo)
|
|
36
33
|
|
|
34
|
+
## WebRTC Polyfills
|
|
35
|
+
|
|
36
|
+
WebRTC polyfills to be used for libraries like `simple-peer`.
|
|
37
|
+
|
|
38
|
+
Please check [here](/polyfill)
|
|
39
|
+
|
|
37
40
|
## Example Usage
|
|
38
41
|
|
|
39
42
|
```js
|
|
@@ -47,29 +50,22 @@ let dc2 = null;
|
|
|
47
50
|
|
|
48
51
|
let peer1 = new nodeDataChannel.PeerConnection('Peer1', { iceServers: ['stun:stun.l.google.com:19302'] });
|
|
49
52
|
|
|
50
|
-
// Set Callbacks
|
|
51
53
|
peer1.onLocalDescription((sdp, type) => {
|
|
52
|
-
console.log('Peer1 SDP:', sdp, ' Type:', type);
|
|
53
54
|
peer2.setRemoteDescription(sdp, type);
|
|
54
55
|
});
|
|
55
56
|
peer1.onLocalCandidate((candidate, mid) => {
|
|
56
|
-
console.log('Peer1 Candidate:', candidate);
|
|
57
57
|
peer2.addRemoteCandidate(candidate, mid);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
let peer2 = new nodeDataChannel.PeerConnection('Peer2', { iceServers: ['stun:stun.l.google.com:19302'] });
|
|
61
61
|
|
|
62
|
-
// Set Callbacks
|
|
63
62
|
peer2.onLocalDescription((sdp, type) => {
|
|
64
|
-
console.log('Peer2 SDP:', sdp, ' Type:', type);
|
|
65
63
|
peer1.setRemoteDescription(sdp, type);
|
|
66
64
|
});
|
|
67
65
|
peer2.onLocalCandidate((candidate, mid) => {
|
|
68
|
-
console.log('Peer2 Candidate:', candidate);
|
|
69
66
|
peer1.addRemoteCandidate(candidate, mid);
|
|
70
67
|
});
|
|
71
68
|
peer2.onDataChannel((dc) => {
|
|
72
|
-
console.log('Peer2 Got DataChannel: ', dc.getLabel());
|
|
73
69
|
dc2 = dc;
|
|
74
70
|
dc2.onMessage((msg) => {
|
|
75
71
|
console.log('Peer2 Received Msg:', msg);
|
|
@@ -86,19 +82,11 @@ dc1.onOpen(() => {
|
|
|
86
82
|
dc1.onMessage((msg) => {
|
|
87
83
|
console.log('Peer1 Received Msg:', msg);
|
|
88
84
|
});
|
|
89
|
-
|
|
90
|
-
setTimeout(() => {
|
|
91
|
-
dc1.close();
|
|
92
|
-
dc2.close();
|
|
93
|
-
peer1.close();
|
|
94
|
-
peer2.close();
|
|
95
|
-
nodeDataChannel.cleanup();
|
|
96
|
-
}, 10 * 1000);
|
|
97
85
|
```
|
|
98
86
|
|
|
99
|
-
##
|
|
87
|
+
## Examples
|
|
100
88
|
|
|
101
|
-
Please check [
|
|
89
|
+
Please check [examples](/examples/) folder
|
|
102
90
|
|
|
103
91
|
## Test
|
|
104
92
|
|
|
@@ -111,14 +99,14 @@ node test/connectivity.js # Connectivity
|
|
|
111
99
|
|
|
112
100
|
Please check [here](/BULDING.md)
|
|
113
101
|
|
|
114
|
-
## Examples
|
|
115
|
-
|
|
116
|
-
Please check [examples](/examples/) folder
|
|
117
|
-
|
|
118
102
|
## API Docs
|
|
119
103
|
|
|
120
104
|
Please check [docs](/API.md) page
|
|
121
105
|
|
|
106
|
+
## Contributing
|
|
107
|
+
|
|
108
|
+
Contributions welcome!
|
|
109
|
+
|
|
122
110
|
## Thanks
|
|
123
111
|
|
|
124
112
|
Thanks to [Streamr](https://streamr.network/) for supporting this project by being a Sponsor!
|
package/package.json
CHANGED