/
RTCDataChannel.cljs
393 lines (279 loc) · 12.3 KB
/
RTCDataChannel.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
(ns web.rtc.RTCDataChannel
"The RTCDataChannel interface represents a network channel which
be used for bidirectional peer-to-peer transfers of arbitrary
Every data channel is associated with an `web.audio.RTCPeerConnection`,
each peer connection can have up to a theoretical maximum of
data channels (the actual limit may vary from browser to browser)."
(:refer-clojure :exclude []))
(defn close
"Method.
The RTCDataChannel.close() method closes the `web.rtc.RTCDataChannel`.
peer is permitted to call this method to initiate closure of
channel.
`RTCDataChannel.close();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/close`"
[this ]
(-> this (.close)))
(defn send
"Method.
The send() method of the `web.rtc.RTCDataChannel` interface sends
across the data channel to the remote peer.
`RTCDataChannel.send(data);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/send`"
[this data]
(-> this (.send data)))
(defn binary-type
"Property.
The property binaryType on the `web.rtc.RTCDataChannel` interface
a `web.dom.DOMString` which specifies the type of JavaScript
which should be used to represent binary data received on the
Values allowed by the `WebSocket.binaryType` property are also
here: \\\"blob\\\" if `web.files.Blob` objects are being used or
if `js.ArrayBuffer` objects are being used. The default is \\\"blob\\\".
`var type = aDataChannel.binaryType;
aDataChannel.binaryType = type;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/binaryType`"
[this]
(-> this (.binaryType)))
(defn set-binary-type!
"Property.
The property binaryType on the `web.rtc.RTCDataChannel` interface
a `web.dom.DOMString` which specifies the type of JavaScript
which should be used to represent binary data received on the
Values allowed by the `WebSocket.binaryType` property are also
here: \\\"blob\\\" if `web.files.Blob` objects are being used or
if `js.ArrayBuffer` objects are being used. The default is \\\"blob\\\".
`var type = aDataChannel.binaryType;
aDataChannel.binaryType = type;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/binaryType`"
[this val]
(aset this "binaryType" val))
(defn buffered-amount
"Property.
The read-only RTCDataChannel property bufferedAmount returns
number of bytes of data currently queued to be sent over the
channel.
`var amount = aDataChannel.bufferedAmount;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/bufferedAmount`"
[this]
(-> this (.bufferedAmount)))
(defn buffered-amount-low-threshold
"Property.
The RTCDataChannel property bufferedAmountLowThreshold is used
specify the number of bytes of buffered outgoing data that is
\\\"low.\\\" The default value is 0.
`var threshold = aDataChannel.bufferedAmountLowThreshold;
aDataChannel.bufferedAmountLowThreshold = threshold;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/bufferedAmountLowThreshold`"
[this]
(-> this (.bufferedAmountLowThreshold)))
(defn set-buffered-amount-low-threshold!
"Property.
The RTCDataChannel property bufferedAmountLowThreshold is used
specify the number of bytes of buffered outgoing data that is
\\\"low.\\\" The default value is 0.
`var threshold = aDataChannel.bufferedAmountLowThreshold;
aDataChannel.bufferedAmountLowThreshold = threshold;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/bufferedAmountLowThreshold`"
[this val]
(aset this "bufferedAmountLowThreshold" val))
(defn id
"Property.
The read-only RTCDataChannel property id returns an ID number
0 and 65,534) which uniquely identifies the `web.rtc.RTCDataChannel`.
`var id = aDataChannel.id;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/id`"
[this]
(-> this (.id)))
(defn label
"Property.
The read-only RTCDataChannel property label returns a `web.dom.DOMString`
a name describing the data channel. These labels are not required
be unique.
`var name = aDataChannel.label;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/label`"
[this]
(-> this (.label)))
(defn max-packet-life-time
"Property.
The read-only RTCDataChannel property maxPacketLifeTime returns
amount of time, in milliseconds, the browser is allowed to take
attempt to transmit a message, as set when the data channel was
or null.
`var lifetime = aDataChannel.maxPacketLifeTime;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/maxPacketLifeTime`"
[this]
(-> this (.maxPacketLifeTime)))
(defn max-retransmits
"Property.
The read-only RTCDataChannel property maxRetransmits returns
maximum number of times the browser should try to retransmit
message before giving up, as set when the data channel was created,
null, which indicates that there is no maximum.
`var tries = aDataChannel.maxRetransmits;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/maxRetransmits`"
[this]
(-> this (.maxRetransmits)))
(defn negotiated
"Property.
The read-only RTCDataChannel property negotiated indicates whether
`web.rtc.RTCDataChannel`'s connection was negotiated by the Web
(true) or by the WebRTC layer (false).
`var negotiated = aDataChannel.negotiated;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/negotiated`"
[this]
(-> this (.negotiated)))
(defn onbufferedamountlow
"Property.
The RTCDataChannel.onbufferedamountlow property is an `EventHandler`
specifies a function the browser calls when the bufferedamountlow
is sent to the `web.rtc.RTCDataChannel`. This event, which is
by a simple `web.event.Event` object, is sent when the amount
data buffered to be sent falls to or below the threshold specified
the channel's `bufferedAmountLowThreshold`.
`RTCDataChannel.onbufferedamountlow = function;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onbufferedamountlow`"
[this]
(-> this (.onbufferedamountlow)))
(defn set-onbufferedamountlow!
"Property.
The RTCDataChannel.onbufferedamountlow property is an `EventHandler`
specifies a function the browser calls when the bufferedamountlow
is sent to the `web.rtc.RTCDataChannel`. This event, which is
by a simple `web.event.Event` object, is sent when the amount
data buffered to be sent falls to or below the threshold specified
the channel's `bufferedAmountLowThreshold`.
`RTCDataChannel.onbufferedamountlow = function;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onbufferedamountlow`"
[this val]
(aset this "onbufferedamountlow" val))
(defn onclose
"Property.
The RTCDataChannel.onclose property is an `EventHandler` which
a function to be called by the browser when the close event is
by the `web.rtc.RTCDataChannel`. This is a simple `web.event.Event`
indicates that the data channel has closed down.
`RTCDataChannel.onclose = function;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onclose`"
[this]
(-> this (.onclose)))
(defn set-onclose!
"Property.
The RTCDataChannel.onclose property is an `EventHandler` which
a function to be called by the browser when the close event is
by the `web.rtc.RTCDataChannel`. This is a simple `web.event.Event`
indicates that the data channel has closed down.
`RTCDataChannel.onclose = function;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onclose`"
[this val]
(aset this "onclose" val))
(defn onerror
"Property.
The RTCDataChannel.onerror property is an `EventHandler` which
a function to be called when the error event is received. When
error occurs on the data channel, the function receives as input
`web.workers.ErrorEvent` object describing the error which occurred.
`RTCDataChannel.onerror = function;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onerror`"
[this]
(-> this (.onerror)))
(defn set-onerror!
"Property.
The RTCDataChannel.onerror property is an `EventHandler` which
a function to be called when the error event is received. When
error occurs on the data channel, the function receives as input
`web.workers.ErrorEvent` object describing the error which occurred.
`RTCDataChannel.onerror = function;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onerror`"
[this val]
(aset this "onerror" val))
(defn onmessage
"Property.
The RTCDataChannel.onmessage property stores an `EventHandler`
specifies a function to be called when the message event is fired
the channel. This event is represented by the `web.workers.MessageEvent`
This event is sent to the channel when a message is received
the other peer.
`RTCDataChannel.onmessage = function;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onmessage`"
[this]
(-> this (.onmessage)))
(defn set-onmessage!
"Property.
The RTCDataChannel.onmessage property stores an `EventHandler`
specifies a function to be called when the message event is fired
the channel. This event is represented by the `web.workers.MessageEvent`
This event is sent to the channel when a message is received
the other peer.
`RTCDataChannel.onmessage = function;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onmessage`"
[this val]
(aset this "onmessage" val))
(defn onopen
"Property.
The RTCDataChannel.onopen property is an `EventHandler` which
a function to be called when the open event is fired; this is
simple `web.event.Event` which is sent when the data channel's
data transport—the link over which the `web.rtc.RTCDataChannel`'s
flow—is established or re-established.
`RTCDataChannel.onopen = function;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onopen`"
[this]
(-> this (.onopen)))
(defn set-onopen!
"Property.
The RTCDataChannel.onopen property is an `EventHandler` which
a function to be called when the open event is fired; this is
simple `web.event.Event` which is sent when the data channel's
data transport—the link over which the `web.rtc.RTCDataChannel`'s
flow—is established or re-established.
`RTCDataChannel.onopen = function;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onopen`"
[this val]
(aset this "onopen" val))
(defn ordered
"Property.
The read-only RTCDataChannel property ordered indicates whether
not the data channel guarantees in-order delivery of messages;
default is true, which indicates that the data channel is indeed
`var ordered = aDataChannel.ordered;
A `js.Boolean` value which is true if in-order delivery is guaranteed and is otherwise false.`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/ordered`"
[this]
(-> this (.ordered)))
(defn protocol
"Property.
The read-only RTCDataChannel property protocol returns a `web.dom.DOMString`
the name of the subprotocol in use. If no protocol was specified
the data channel was created, then this property's value is \\\"\\\"
empty string).
`var subProtocol = aDataChannel.protocol;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/protocol`"
[this]
(-> this (.protocol)))
(defn ready-state
"Property.
The read-only RTCDataChannel property readyState returns an enum
type RTCDataChannelState which indicates the state of the data
underlying data connection.
`var state = aDataChannel.readyState;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/readyState`"
[this]
(-> this (.readyState)))
(defn reliable
"Property.
The read-only RTCDataChannel property reliable indicates whether
not the data channel is reliable.
`var reliable = aDataChannel.reliable;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/reliable`"
[this]
(-> this (.reliable)))
(defn stream
"Property.
The deprecated (and never part of the official specification)
RTCDataChannel property stream returns an ID number (between
and 65,535) which uniquely identifies the `web.rtc.RTCDataChannel`.
`var stream = aDataChannel.stream;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/stream`"
[this]
(-> this (.stream)))