Socket
Socket
Sign inDemoInstall

rtcpeerconnection

Package Overview
Dependencies
Maintainers
1
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 1.0.1 to 1.1.0

5

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

@@ -23,3 +23,6 @@ "main": "rtcpeerconnection.js",

"browserify": "2.x"
},
"jshintConfig": {
"expr": true
}
}

@@ -363,2 +363,37 @@ (function(e){if("function"==typeof bootstrap)bootstrap("peerconnection",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makePeerConnection=e}else"undefined"!=typeof window?window.PeerConnection=e():global.PeerConnection=e()})(function(){var define,ses,bootstrap,module,exports;

// Create a data channel spec reference:
// http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCDataChannelInit
PeerConnection.prototype.createDataChannel = function (name, opts) {
opts || (opts = {});
var reliable = !!opts.reliable;
var protocol = opts.protocol || 'text/plain';
var negotiated = !!(opts.negotiated || opts.preset);
var settings;
var channel;
// firefox is a bit more finnicky
if (webrtc.prefix === 'moz') {
if (reliable) {
settings = {
protocol: protocol,
preset: negotiated,
stream: name
};
} else {
settings = {};
}
channel = this.pc.createDataChannel(name, settings);
channel.binaryType = 'blob';
} else {
if (reliable) {
settings = {
reliable: true
};
} else {
settings = {reliable: false};
}
channel = this.pc.createDataChannel(name, settings);
}
return channel;
};
module.exports = PeerConnection;

@@ -365,0 +400,0 @@

@@ -185,2 +185,37 @@ var WildEmitter = require('wildemitter');

// Create a data channel spec reference:
// http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCDataChannelInit
PeerConnection.prototype.createDataChannel = function (name, opts) {
opts || (opts = {});
var reliable = !!opts.reliable;
var protocol = opts.protocol || 'text/plain';
var negotiated = !!(opts.negotiated || opts.preset);
var settings;
var channel;
// firefox is a bit more finnicky
if (webrtc.prefix === 'moz') {
if (reliable) {
settings = {
protocol: protocol,
preset: negotiated,
stream: name
};
} else {
settings = {};
}
channel = this.pc.createDataChannel(name, settings);
channel.binaryType = 'blob';
} else {
if (reliable) {
settings = {
reliable: true
};
} else {
settings = {reliable: false};
}
channel = this.pc.createDataChannel(name, settings);
}
return channel;
};
module.exports = PeerConnection;
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