Modularize datachannel options.
parent
80dc0a51d9
commit
3231f4248a
|
|
@ -4,3 +4,8 @@ export const peerConnectionConfig = {
|
|||
{'urls': 'stun:stun.l.google.com:19302'},
|
||||
],
|
||||
};
|
||||
|
||||
export const dataChannelConfig = {
|
||||
ordered: false, // do not guarantee order
|
||||
maxRetransmitTime: 500, // in milliseconds
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { peerConnectionConfig } from './config.js';
|
||||
import { dataChannelConfig, peerConnectionConfig } from './config.js';
|
||||
|
||||
var localVideo;
|
||||
var localStream;
|
||||
|
|
@ -8,11 +8,6 @@ var uuid;
|
|||
var serverConnection;
|
||||
var dataChannel;
|
||||
|
||||
var dataChannelOptions = {
|
||||
ordered: false, // do not guarantee order
|
||||
maxRetransmitTime: 500, // in milliseconds
|
||||
};
|
||||
|
||||
function pageReady() {
|
||||
document.querySelector("button#start")
|
||||
.addEventListener("click", start);
|
||||
|
|
@ -53,7 +48,7 @@ function start(isCaller) {
|
|||
dataChannel.channel.send('Hello there, I got your signal');
|
||||
});
|
||||
|
||||
dataChannel = peerConnection.createDataChannel("myLabel", dataChannelOptions);
|
||||
dataChannel = peerConnection.createDataChannel("myLabel", dataChannelConfig);
|
||||
dataChannel.addEventListener('error', function (error) {
|
||||
console.log("Data Channel Error:", error);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue