Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function RtcConnection(id) {
var rtc = new Peer(id,{key: __ApiKey})
rtc.on('open', function(id) { console.log('>> opened, got id:',id) })
rtc.on('error', function(err) { console.log('>> had error:'); throw err })
rtc.on('close', function() { console.log('>> closed') })
rtc.on('connection', function(dataConnection) {
console.log('>> got connection')
// connection open
dataConnection.on('open',function() {
dataConnectionHasOpened(rtc,dataConnection)
})
})
return rtc
}