node-datachannel 0.3.3 → 0.3.4
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/API.md +214 -0
- package/BULDING.md +19 -0
- package/CMakeLists.txt +2 -2
- package/README.md +28 -252
- package/package.json +1 -1
package/API.md
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# API
|
|
2
|
+
|
|
3
|
+
## PeerConnection Class
|
|
4
|
+
|
|
5
|
+
**Constructor**
|
|
6
|
+
|
|
7
|
+
let pc = new PeerConnection(peerName[,options])
|
|
8
|
+
- peerName `<string>` Peer name to use for logs etc..
|
|
9
|
+
- options `<Object>` WebRTC Config Options
|
|
10
|
+
```
|
|
11
|
+
export interface RtcConfig {
|
|
12
|
+
iceServers: (string | IceServer)[];
|
|
13
|
+
proxyServer?: ProxyServer;
|
|
14
|
+
enableIceTcp?: boolean;
|
|
15
|
+
enableIceUdpMux?: boolean;
|
|
16
|
+
portRangeBegin?: number;
|
|
17
|
+
portRangeEnd?: number;
|
|
18
|
+
maxMessageSize?: number;
|
|
19
|
+
mtu?: number;
|
|
20
|
+
iceTransportPolicy?: TransportPolicy;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const enum RelayType {
|
|
24
|
+
TurnUdp = 'TurnUdp',
|
|
25
|
+
TurnTcp = 'TurnTcp',
|
|
26
|
+
TurnTls = 'TurnTls'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface IceServer {
|
|
30
|
+
hostname: string;
|
|
31
|
+
port: number;
|
|
32
|
+
username?: string;
|
|
33
|
+
password?: string;
|
|
34
|
+
relayType?: RelayType;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type TransportPolicy = 'all' | 'relay';
|
|
38
|
+
|
|
39
|
+
"iceServers" option is an array of stun/turn server urls
|
|
40
|
+
Examples;
|
|
41
|
+
STUN Server Example : stun:stun.l.google.com:19302
|
|
42
|
+
TURN Server Example : turn:USERNAME:PASSWORD@TURN_IP_OR_ADDRESS:PORT
|
|
43
|
+
TURN Server Example (TCP) : turn:USERNAME:PASSWORD@TURN_IP_OR_ADDRESS:PORT?transport=tcp
|
|
44
|
+
TURN Server Example (TLS) : turns:USERNAME:PASSWORD@TURN_IP_OR_ADDRESS:PORT
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**close: () => void**
|
|
49
|
+
|
|
50
|
+
Close Peer Connection
|
|
51
|
+
|
|
52
|
+
**setRemoteDescription: (sdp: string, type: DescriptionType) => void**
|
|
53
|
+
|
|
54
|
+
Set Remote Description
|
|
55
|
+
```
|
|
56
|
+
export const enum DescriptionType {
|
|
57
|
+
Unspec = 'Unspec',
|
|
58
|
+
Offer = 'Offer',
|
|
59
|
+
Answer = 'Answer'
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**addRemoteCandidate: (candidate: string, mid: string) => void**
|
|
64
|
+
|
|
65
|
+
Add remote candidate info
|
|
66
|
+
|
|
67
|
+
**createDataChannel: (label: string, config?: DataChannelInitConfig) => DataChannel**
|
|
68
|
+
|
|
69
|
+
Create new data-channel
|
|
70
|
+
* label `<string>` Data channel name
|
|
71
|
+
* config `<Object>` Data channel options
|
|
72
|
+
```
|
|
73
|
+
export interface DataChannelInitConfig {
|
|
74
|
+
protocol?: string;
|
|
75
|
+
negotiated?: boolean;
|
|
76
|
+
id?: number;
|
|
77
|
+
ordered?: boolean;
|
|
78
|
+
maxPacketLifeTime?: number;
|
|
79
|
+
maxRetransmits?: number;
|
|
80
|
+
|
|
81
|
+
// Deprecated, use ordered, maxPacketLifeTime, and maxRetransmits
|
|
82
|
+
reliability?: {
|
|
83
|
+
type?: ReliabilityType;
|
|
84
|
+
unordered?: boolean;
|
|
85
|
+
rexmit?: number;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const enum ReliabilityType {
|
|
90
|
+
Reliable = 0, Rexmit = 1, Timed = 2
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
**state: () => string**
|
|
94
|
+
|
|
95
|
+
Get current state
|
|
96
|
+
|
|
97
|
+
**signalingState: () => string**
|
|
98
|
+
|
|
99
|
+
Get current signaling state
|
|
100
|
+
|
|
101
|
+
**gatheringState: () => string**
|
|
102
|
+
|
|
103
|
+
Get current gathering state
|
|
104
|
+
|
|
105
|
+
**onLocalDescription: (cb: (sdp: string, type: DescriptionType) => void) => void**
|
|
106
|
+
|
|
107
|
+
Local Description Callback
|
|
108
|
+
```
|
|
109
|
+
export const enum DescriptionType {
|
|
110
|
+
Unspec = 'Unspec',
|
|
111
|
+
Offer = 'Offer',
|
|
112
|
+
Answer = 'Answer'
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**onLocalCandidate: (cb: (candidate: string, mid: string) => void) => void**
|
|
117
|
+
|
|
118
|
+
Local Candidate Callback
|
|
119
|
+
|
|
120
|
+
**onStateChange: (cb: (state: string) => void) => void**
|
|
121
|
+
|
|
122
|
+
State Change Callback
|
|
123
|
+
|
|
124
|
+
**onSignalingStateChange: (state: (sdp: string) => void) => void**
|
|
125
|
+
|
|
126
|
+
Signaling State Change Callback
|
|
127
|
+
|
|
128
|
+
**onGatheringStateChange: (state: (sdp: string) => void) => void**
|
|
129
|
+
|
|
130
|
+
Gathering State Change Callback
|
|
131
|
+
|
|
132
|
+
**onDataChannel: (cb: (dc: DataChannel) => void) => void**
|
|
133
|
+
|
|
134
|
+
New Data Channel Callback
|
|
135
|
+
|
|
136
|
+
**bytesSent: () => number**
|
|
137
|
+
|
|
138
|
+
Get bytes sent stat
|
|
139
|
+
|
|
140
|
+
**bytesReceived: () => number**
|
|
141
|
+
|
|
142
|
+
Get bytes received stat
|
|
143
|
+
|
|
144
|
+
**rtt: () => number**
|
|
145
|
+
|
|
146
|
+
Get rtt stat
|
|
147
|
+
|
|
148
|
+
**getSelectedCandidatePair: () => { local: SelectedCandidateInfo, remote: SelectedCandidateInfo }**
|
|
149
|
+
|
|
150
|
+
Get info about selected candidate pair
|
|
151
|
+
```
|
|
152
|
+
export interface SelectedCandidateInfo {
|
|
153
|
+
address: string;
|
|
154
|
+
port: number;
|
|
155
|
+
type: string;
|
|
156
|
+
transportType: string;
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## DataChannel Class
|
|
161
|
+
|
|
162
|
+
> You can create a new Datachannel instance by calling `PeerConnection.createDataChannel` function.
|
|
163
|
+
|
|
164
|
+
**close: () => void**
|
|
165
|
+
|
|
166
|
+
Close data channel
|
|
167
|
+
|
|
168
|
+
**getLabel: () => string**
|
|
169
|
+
|
|
170
|
+
Get label of data-channel
|
|
171
|
+
|
|
172
|
+
**sendMessage: (msg: string) => boolean**
|
|
173
|
+
|
|
174
|
+
Send Message as string
|
|
175
|
+
|
|
176
|
+
**sendMessageBinary: (buffer: Buffer) => boolean**
|
|
177
|
+
|
|
178
|
+
Send Message as binary
|
|
179
|
+
|
|
180
|
+
**isOpen: () => boolean**
|
|
181
|
+
|
|
182
|
+
Query data-channel
|
|
183
|
+
|
|
184
|
+
**bufferedAmount: () => number**
|
|
185
|
+
|
|
186
|
+
Get current buffered amount level
|
|
187
|
+
|
|
188
|
+
**maxMessageSize: () => number**
|
|
189
|
+
|
|
190
|
+
Get max message size of the data-channel, that could be sent
|
|
191
|
+
|
|
192
|
+
**setBufferedAmountLowThreshold: (newSize: number) => void**
|
|
193
|
+
|
|
194
|
+
Set buffer level of the `onBufferedAmountLow` callback
|
|
195
|
+
|
|
196
|
+
**onOpen: (cb: () => void) => void**
|
|
197
|
+
|
|
198
|
+
Open callback
|
|
199
|
+
|
|
200
|
+
**onClosed: (cb: () => void) => void**
|
|
201
|
+
|
|
202
|
+
Closed callback
|
|
203
|
+
|
|
204
|
+
**onError: (cb: (err: string) => void) => void**
|
|
205
|
+
|
|
206
|
+
Error callback
|
|
207
|
+
|
|
208
|
+
**onBufferedAmountLow: (cb: () => void) => void**
|
|
209
|
+
|
|
210
|
+
Buffer level low callback
|
|
211
|
+
|
|
212
|
+
**onMessage: (cb: (msg: string | Buffer) => void) => void**
|
|
213
|
+
|
|
214
|
+
New Message callback
|
package/BULDING.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Build
|
|
2
|
+
|
|
3
|
+
## Requirements
|
|
4
|
+
* cmake >= V3.14
|
|
5
|
+
* [libdatachannel dependencies](https://github.com/paullouisageneau/libdatachannel/blob/master/README.md#dependencies)
|
|
6
|
+
|
|
7
|
+
## Building from source
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
> git clone https://github.com/murat-dogan/node-datachannel.git
|
|
11
|
+
> cd node-datachannel
|
|
12
|
+
> npm i
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Other Options
|
|
16
|
+
```sh
|
|
17
|
+
> npm run install -- -DUSE_GNUTLS=1 # Use GnuTLS instead of OpenSSL (Default False)
|
|
18
|
+
> npm run install -- -DUSE_NICE=1 # Use libnice instead of libjuice (Default False)
|
|
19
|
+
```
|
package/CMakeLists.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.15)
|
|
2
2
|
cmake_policy(SET CMP0091 NEW)
|
|
3
|
-
project(node_datachannel VERSION 0.3.
|
|
3
|
+
project(node_datachannel VERSION 0.3.4)
|
|
4
4
|
|
|
5
5
|
# Workaround for https://github.com/murat-dogan/node-datachannel/issues/65
|
|
6
6
|
if( NODE_RUNTIMEVERSION VERSION_GREATER_EQUAL "17.0.0")
|
|
@@ -33,7 +33,7 @@ include(FetchContent)
|
|
|
33
33
|
FetchContent_Declare(
|
|
34
34
|
libdatachannel
|
|
35
35
|
GIT_REPOSITORY https://github.com/paullouisageneau/libdatachannel.git
|
|
36
|
-
GIT_TAG "v0.17.
|
|
36
|
+
GIT_TAG "v0.17.7"
|
|
37
37
|
)
|
|
38
38
|
|
|
39
39
|
option(NO_MEDIA "Disable media transport support in libdatachannel" OFF)
|
package/README.md
CHANGED
|
@@ -6,17 +6,33 @@
|
|
|
6
6
|
- Lightweight
|
|
7
7
|
- No need to deal with WebRTC stack!
|
|
8
8
|
- Small binary sizes
|
|
9
|
-
- Has Prebuilt binaries (Linux,Windows,ARM)
|
|
10
9
|
- Type infos for Typescript
|
|
11
10
|
|
|
12
|
-
> "libdatachannel is a standalone implementation of WebRTC Data Channels, WebRTC Media Transport, and WebSockets in C++17 with C bindings for POSIX platforms (including GNU/Linux, Android, and Apple macOS) and Microsoft Windows. It enables direct connectivity between native applications and web browsers without the pain of importing the entire WebRTC stack. "
|
|
13
|
-
|
|
14
|
-
|
|
15
11
|
This project is NodeJS bindings for [libdatachannel](https://github.com/paullouisageneau/libdatachannel) library.
|
|
16
12
|
|
|
17
13
|
Please check [libdatachannel](https://github.com/paullouisageneau/libdatachannel) for Compatibility & WebRTC details.
|
|
18
14
|
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install node-datachannel
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Supported Platforms
|
|
22
|
+
|
|
23
|
+
| | Linux-x64 | Linux-armv7 | Linux-arm64 | Windows-x86 | Windows-x64 | Mac |
|
|
24
|
+
|----------|:---------:|:-----------:|:-----------:|:-----------:|:-----------:|:---:|
|
|
25
|
+
| Node V10 | + | + | + | + | + | + |
|
|
26
|
+
| Node V11 | + | + | + | + | + | + |
|
|
27
|
+
| Node V12 | + | + | + | + | + | + |
|
|
28
|
+
| Node V13 | + | + | + | + | + | + |
|
|
29
|
+
| Node V14 | + | + | + | + | + | + |
|
|
30
|
+
| Node V15 | + | + | + | + | + | + |
|
|
31
|
+
| Node V16 | + | + | + | + | + | + |
|
|
32
|
+
| Node V17 | + | + | + | + | + | + |
|
|
33
|
+
|
|
19
34
|
## Example Usage
|
|
35
|
+
|
|
20
36
|
```js
|
|
21
37
|
const nodeDataChannel = require('node-datachannel');
|
|
22
38
|
|
|
@@ -77,266 +93,26 @@ setTimeout(() => {
|
|
|
77
93
|
}, 10 * 1000);
|
|
78
94
|
```
|
|
79
95
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
## Install
|
|
83
|
-
|
|
84
|
-
Prebuilt binaries are available (Node Version >= 10);
|
|
85
|
-
* Windows (x86, x64)
|
|
86
|
-
* Linux (x64, armv7, arm64)
|
|
87
|
-
* Mac
|
|
88
|
-
|
|
96
|
+
## Test
|
|
89
97
|
```sh
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
## API
|
|
94
|
-
|
|
95
|
-
### PeerConnection Class
|
|
96
|
-
|
|
97
|
-
**Constructor**
|
|
98
|
-
|
|
99
|
-
let pc = new PeerConnection(peerName[,options])
|
|
100
|
-
- peerName `<string>` Peer name to use for logs etc..
|
|
101
|
-
- options `<Object>` WebRTC Config Options
|
|
102
|
-
```
|
|
103
|
-
export interface RtcConfig {
|
|
104
|
-
iceServers: (string | IceServer)[];
|
|
105
|
-
proxyServer?: ProxyServer;
|
|
106
|
-
enableIceTcp?: boolean;
|
|
107
|
-
enableIceUdpMux?: boolean;
|
|
108
|
-
portRangeBegin?: number;
|
|
109
|
-
portRangeEnd?: number;
|
|
110
|
-
maxMessageSize?: number;
|
|
111
|
-
mtu?: number;
|
|
112
|
-
iceTransportPolicy?: TransportPolicy;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export const enum RelayType {
|
|
116
|
-
TurnUdp = 'TurnUdp',
|
|
117
|
-
TurnTcp = 'TurnTcp',
|
|
118
|
-
TurnTls = 'TurnTls'
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface IceServer {
|
|
122
|
-
hostname: string;
|
|
123
|
-
port: number;
|
|
124
|
-
username?: string;
|
|
125
|
-
password?: string;
|
|
126
|
-
relayType?: RelayType;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export type TransportPolicy = 'all' | 'relay';
|
|
130
|
-
|
|
131
|
-
"iceServers" option is an array of stun/turn server urls
|
|
132
|
-
Examples;
|
|
133
|
-
STUN Server Example : stun:stun.l.google.com:19302
|
|
134
|
-
TURN Server Example : turn:USERNAME:PASSWORD@TURN_IP_OR_ADDRESS:PORT
|
|
135
|
-
TURN Server Example (TCP) : turn:USERNAME:PASSWORD@TURN_IP_OR_ADDRESS:PORT?transport=tcp
|
|
136
|
-
TURN Server Example (TLS) : turns:USERNAME:PASSWORD@TURN_IP_OR_ADDRESS:PORT
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
**close: () => void**
|
|
141
|
-
|
|
142
|
-
Close Peer Connection
|
|
143
|
-
|
|
144
|
-
**setRemoteDescription: (sdp: string, type: DescriptionType) => void**
|
|
145
|
-
|
|
146
|
-
Set Remote Description
|
|
147
|
-
```
|
|
148
|
-
export const enum DescriptionType {
|
|
149
|
-
Unspec = 'Unspec',
|
|
150
|
-
Offer = 'Offer',
|
|
151
|
-
Answer = 'Answer'
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
**addRemoteCandidate: (candidate: string, mid: string) => void**
|
|
156
|
-
|
|
157
|
-
Add remote candidate info
|
|
158
|
-
|
|
159
|
-
**createDataChannel: (label: string, config?: DataChannelInitConfig) => DataChannel**
|
|
160
|
-
|
|
161
|
-
Create new data-channel
|
|
162
|
-
* label `<string>` Data channel name
|
|
163
|
-
* config `<Object>` Data channel options
|
|
164
|
-
```
|
|
165
|
-
export interface DataChannelInitConfig {
|
|
166
|
-
protocol?: string;
|
|
167
|
-
negotiated?: boolean;
|
|
168
|
-
id?: number;
|
|
169
|
-
ordered?: boolean;
|
|
170
|
-
maxPacketLifeTime?: number;
|
|
171
|
-
maxRetransmits?: number;
|
|
172
|
-
|
|
173
|
-
// Deprecated, use ordered, maxPacketLifeTime, and maxRetransmits
|
|
174
|
-
reliability?: {
|
|
175
|
-
type?: ReliabilityType;
|
|
176
|
-
unordered?: boolean;
|
|
177
|
-
rexmit?: number;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export const enum ReliabilityType {
|
|
182
|
-
Reliable = 0, Rexmit = 1, Timed = 2
|
|
183
|
-
}
|
|
184
|
-
```
|
|
185
|
-
**state: () => string**
|
|
186
|
-
|
|
187
|
-
Get current state
|
|
188
|
-
|
|
189
|
-
**signalingState: () => string**
|
|
190
|
-
|
|
191
|
-
Get current signaling state
|
|
192
|
-
|
|
193
|
-
**gatheringState: () => string**
|
|
194
|
-
|
|
195
|
-
Get current gathering state
|
|
196
|
-
|
|
197
|
-
**onLocalDescription: (cb: (sdp: string, type: DescriptionType) => void) => void**
|
|
198
|
-
|
|
199
|
-
Local Description Callback
|
|
200
|
-
```
|
|
201
|
-
export const enum DescriptionType {
|
|
202
|
-
Unspec = 'Unspec',
|
|
203
|
-
Offer = 'Offer',
|
|
204
|
-
Answer = 'Answer'
|
|
205
|
-
}
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
**onLocalCandidate: (cb: (candidate: string, mid: string) => void) => void**
|
|
209
|
-
|
|
210
|
-
Local Candidate Callback
|
|
211
|
-
|
|
212
|
-
**onStateChange: (cb: (state: string) => void) => void**
|
|
213
|
-
|
|
214
|
-
State Change Callback
|
|
215
|
-
|
|
216
|
-
**onSignalingStateChange: (state: (sdp: string) => void) => void**
|
|
217
|
-
|
|
218
|
-
Signaling State Change Callback
|
|
219
|
-
|
|
220
|
-
**onGatheringStateChange: (state: (sdp: string) => void) => void**
|
|
221
|
-
|
|
222
|
-
Gathering State Change Callback
|
|
223
|
-
|
|
224
|
-
**onDataChannel: (cb: (dc: DataChannel) => void) => void**
|
|
225
|
-
|
|
226
|
-
New Data Channel Callback
|
|
227
|
-
|
|
228
|
-
**bytesSent: () => number**
|
|
229
|
-
|
|
230
|
-
Get bytes sent stat
|
|
231
|
-
|
|
232
|
-
**bytesReceived: () => number**
|
|
233
|
-
|
|
234
|
-
Get bytes received stat
|
|
235
|
-
|
|
236
|
-
**rtt: () => number**
|
|
237
|
-
|
|
238
|
-
Get rtt stat
|
|
239
|
-
|
|
240
|
-
**getSelectedCandidatePair: () => { local: SelectedCandidateInfo, remote: SelectedCandidateInfo }**
|
|
241
|
-
|
|
242
|
-
Get info about selected candidate pair
|
|
98
|
+
npm run test # Unit tests
|
|
99
|
+
node test/connectivity.js # Connectivity
|
|
243
100
|
```
|
|
244
|
-
export interface SelectedCandidateInfo {
|
|
245
|
-
address: string;
|
|
246
|
-
port: number;
|
|
247
|
-
type: string;
|
|
248
|
-
transportType: string;
|
|
249
|
-
}
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
### DataChannel Class
|
|
253
|
-
|
|
254
|
-
> You can create a new Datachannel instance by calling `PeerConnection.createDataChannel` function.
|
|
255
|
-
|
|
256
|
-
**close: () => void**
|
|
257
|
-
|
|
258
|
-
Close data channel
|
|
259
|
-
|
|
260
|
-
**getLabel: () => string**
|
|
261
|
-
|
|
262
|
-
Get label of data-channel
|
|
263
|
-
|
|
264
|
-
**sendMessage: (msg: string) => boolean**
|
|
265
|
-
|
|
266
|
-
Send Message as string
|
|
267
|
-
|
|
268
|
-
**sendMessageBinary: (buffer: Buffer) => boolean**
|
|
269
|
-
|
|
270
|
-
Send Message as binary
|
|
271
101
|
|
|
272
|
-
**isOpen: () => boolean**
|
|
273
|
-
|
|
274
|
-
Query data-channel
|
|
275
|
-
|
|
276
|
-
**bufferedAmount: () => number**
|
|
277
|
-
|
|
278
|
-
Get current buffered amount level
|
|
279
|
-
|
|
280
|
-
**maxMessageSize: () => number**
|
|
281
|
-
|
|
282
|
-
Get max message size of the data-channel, that could be sent
|
|
283
|
-
|
|
284
|
-
**setBufferedAmountLowThreshold: (newSize: number) => void**
|
|
285
|
-
|
|
286
|
-
Set buffer level of the `onBufferedAmountLow` callback
|
|
287
|
-
|
|
288
|
-
**onOpen: (cb: () => void) => void**
|
|
289
|
-
|
|
290
|
-
Open callback
|
|
291
|
-
|
|
292
|
-
**onClosed: (cb: () => void) => void**
|
|
293
|
-
|
|
294
|
-
Closed callback
|
|
295
|
-
|
|
296
|
-
**onError: (cb: (err: string) => void) => void**
|
|
297
|
-
|
|
298
|
-
Error callback
|
|
299
|
-
|
|
300
|
-
**onBufferedAmountLow: (cb: () => void) => void**
|
|
301
|
-
|
|
302
|
-
Buffer level low callback
|
|
303
|
-
|
|
304
|
-
**onMessage: (cb: (msg: string | Buffer) => void) => void**
|
|
305
|
-
|
|
306
|
-
New Message callback
|
|
307
102
|
|
|
308
103
|
## Build
|
|
309
104
|
|
|
310
|
-
|
|
311
|
-
* cmake >= V3.14
|
|
312
|
-
* [libdatachannel dependencies](https://github.com/paullouisageneau/libdatachannel/blob/master/README.md#dependencies)
|
|
105
|
+
Please check [here](/BULDING.md)
|
|
313
106
|
|
|
314
|
-
|
|
107
|
+
## Examples
|
|
315
108
|
|
|
316
|
-
|
|
317
|
-
> git clone https://github.com/murat-dogan/node-datachannel.git
|
|
318
|
-
> cd node-datachannel
|
|
319
|
-
> npm i
|
|
320
|
-
```
|
|
109
|
+
Please check [examples](/examples/) folder
|
|
321
110
|
|
|
322
|
-
|
|
323
|
-
```sh
|
|
324
|
-
> npm run install -- -DUSE_GNUTLS=1 # Use GnuTLS instead of OpenSSL (Default False)
|
|
325
|
-
> npm run install -- -DUSE_NICE=1 # Use libnice instead of libjuice (Default False)
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
### Test
|
|
329
|
-
```sh
|
|
330
|
-
> npm run test # Unit tests
|
|
331
|
-
> node test/connectivity.js # Connectivity
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
### More Examples
|
|
111
|
+
## API Docs
|
|
335
112
|
|
|
336
|
-
|
|
113
|
+
Please check [docs](/API.md) page
|
|
337
114
|
|
|
338
115
|
## Thanks
|
|
339
116
|
|
|
340
|
-
|
|
341
117
|
Thanks to [Streamr](https://streamr.network/) for supporting this project by being a Sponsor!
|
|
342
118
|
|