Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rtcpeerconnection

Package Overview
Dependencies
Maintainers
5
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rtcpeerconnection - npm Package Compare versions

Comparing version 5.0.2 to 5.1.0

2

package.json
{
"name": "rtcpeerconnection",
"version": "5.0.2",
"version": "5.1.0",
"description": "A tiny browser module that normalizes and simplifies the API for WebRTC peer connections.",

@@ -5,0 +5,0 @@ "main": "rtcpeerconnection.js",

@@ -150,2 +150,3 @@ var util = require('util');

ice: {},
remoteIce: {},
sid: '',

@@ -258,20 +259,59 @@ isInitiator: true,

var mid = content.name;
var remoteContent = self.remoteDescription.contents.find(function (c) {
return c.name === content.name;
});
candidates.forEach(
function (candidate) {
var iceCandidate = SJJ.toCandidateSDP(candidate) + '\r\n';
self.pc.addIceCandidate(
new RTCIceCandidate({
candidate: iceCandidate,
sdpMLineIndex: mline,
sdpMid: mid
}), function () {
// well, this success callback is pretty meaningless
},
function (err) {
self.emit('error', err);
}
);
self._checkRemoteCandidate(iceCandidate);
});
// process candidates as a callback, in case we need to
// update ufrag and pwd with offer/answer
var processCandidates = function () {
candidates.forEach(
function (candidate) {
var iceCandidate = SJJ.toCandidateSDP(candidate) + '\r\n';
self.pc.addIceCandidate(
new RTCIceCandidate({
candidate: iceCandidate,
sdpMLineIndex: mline,
sdpMid: mid
}), function () {
// well, this success callback is pretty meaningless
},
function (err) {
self.emit('error', err);
}
);
self._checkRemoteCandidate(iceCandidate);
});
cb();
};
if (self.config.remoteIce[content.name] && transport.ufrag &&
self.config.remoteIce[content.name].ufrag !== transport.ufrag) {
console.log('ice restart needed', transport);
if (remoteContent) {
remoteContent.transport.ufrag = transport.ufrag;
remoteContent.transport.pwd = transport.pwd;
var offer = {
type: 'offer',
jingle: self.remoteDescription
};
offer.sdp = SJJ.toSessionSDP(offer.jingle, {
sid: self.config.sdpSessionID,
role: self._role(),
direction: 'incoming'
});
self.pc.setRemoteDescription(new RTCSessionDescription(offer),
function () {
console.log('ice success updating remote desctipion');
processCandidates();
},
function (err) {
console.error('ice failed to update remote description', err);
}
);
} else {
console.error('ice failed to find matching content');
}
} else {
processCandidates();
}
});

@@ -300,4 +340,4 @@ } else {

self._checkRemoteCandidate(update.candidate.candidate);
cb();
}
cb();
};

@@ -394,2 +434,3 @@

}
});

@@ -435,2 +476,12 @@ }

}
// Save ICE credentials
each(offer.jingle.contents, function (content) {
var transport = content.transport || {};
if (transport.ufrag) {
self.config.remoteIce[content.name] = {
ufrag: transport.ufrag,
pwd: transport.pwd
};
}
});
offer.sdp = SJJ.toSessionSDP(offer.jingle, {

@@ -503,2 +554,13 @@ sid: self.config.sdpSessionID,

self.remoteDescription = answer.jingle;
// Save ICE credentials
each(answer.jingle.contents, function (content) {
var transport = content.transport || {};
if (transport.ufrag) {
self.config.remoteIce[content.name] = {
ufrag: transport.ufrag,
pwd: transport.pwd
};
}
});
}

@@ -505,0 +567,0 @@ answer.sdp.split('\r\n').forEach(function (line) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc