Modularize datachannel options.

pull/25/head
Pontus Persson 2017-12-08 15:29:45 +01:00 committed by Pontus Alexander
parent 80dc0a51d9
commit 3231f4248a
2 changed files with 7 additions and 7 deletions

View File

@ -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
};

View File

@ -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);
});