diff --git a/client/config.js b/client/config.js index 3e07031..0e2b35f 100644 --- a/client/config.js +++ b/client/config.js @@ -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 +}; diff --git a/client/webrtc.js b/client/webrtc.js index a863fda..e3594ee 100755 --- a/client/webrtc.js +++ b/client/webrtc.js @@ -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); });