INNER CODE UNIT · JavaScript
getRtcConfig
webtorrent/instant.io · client/index.js:99
function getRtcConfig (cb) {
// WARNING: This is *NOT* a public endpoint. Do not depend on it in your app.
get.concat({
url: '/__rtcConfig__',
timeout: 5000
}, function (err, res, data) {
if (err || res.statusCode !== 200) {
cb(new Error('Could not get WebRTC config from server. Using default (without TURN).'))
} else {
try {
data = JSON.parse(data)
} catch (err) {
return cb(new Error('Got invalid WebRTC config from server: ' + data))
}
debug('got rtc config: %o', data.rtcConfig)
cb(null, data.rtcConfig)
}
})