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

peer-data

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

peer-data - npm Package Compare versions

Comparing version 1.2.4 to 1.2.5

2

dist/peer-data.js

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("socket.io-client")):"function"==typeof define&&define.amd?define(["exports","socket.io-client"],n):n(e["peer-data"]=e["peer-data"]||{},e.io)}(this,function(e,n){"use strict";var t={},r=function(){function e(){}return e.register=function(e,n){t[e]||(t[e]=[]),t[e].push(n)},e.dispatch=function(e,n){t[e].forEach(function(e){return e(n)})},e}(),o=function(){function e(){}return e}();o.CONNECT="CONNECT",o.DISCONNECT="DISCONNECT",o.CANDIDATE="CANDIDATE",o.OFFER="OFFER",o.ANSWER="ANSWER",o.ERROR="ERROR";var i=function(){function e(e,n){void 0===e&&(e={}),void 0===n&&(n=null),this._servers={},this._dataConstraints=null,this._peers={},this._channels={},this._servers=e,this._dataConstraints=n}return Object.defineProperty(e.prototype,"peers",{get:function(){return this._peers},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"channels",{get:function(){return this._channels},enumerable:!0,configurable:!0}),e.prototype.addPeer=function(e,n){var t=this;return this._peers.hasOwnProperty(e)||(this._peers[e]=n,n.onconnectionstatechange=function(r){"closed"===n.connectionState&&t.removePeer(e)}),this},e.prototype.getPeer=function(e){return this._peers.hasOwnProperty(e)?this._peers[e]:null},e.prototype.removePeer=function(e){return this._peers.hasOwnProperty(e)&&(this._peers[e].close(),delete this._peers[e]),this},e.prototype.addChannel=function(e,n){var t=this;return this._channels.hasOwnProperty(e)||(this._channels[e]=n,n.onclose=function(n){return t.removeChannel(e)}),this},e.prototype.getChannel=function(e){return this._channels.hasOwnProperty(e)?this._channels[e]:null},e.prototype.removeChannel=function(e){return this._channels.hasOwnProperty(e)&&(this._channels[e].close(),delete this._channels[e]),this},Object.defineProperty(e.prototype,"servers",{get:function(){return this._servers},set:function(e){this._servers=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataConstraints",{get:function(){return this._dataConstraints},set:function(e){this._dataConstraints=e},enumerable:!0,configurable:!0}),e}(),c=function(){function e(){}return e.get=function(e,n){var t=new RTCPeerConnection(e);return t.onicecandidate=function(e){if(e.candidate){var t={type:o.CANDIDATE,caller:null,callee:n.caller,room:n.room,data:e.candidate};r.dispatch("send",t)}},t},e}(),s=function(){function e(){}return e.get=function(e,n){var t=Math.floor(1e16*(1+Math.random())).toString(16).substring(1);return e.createDataChannel(t,n)},e}(),a=function(){function e(){}return e}();a.LOG="LOG",a.ERROR="ERROR",a.PEER="PEER",a.CHANNEL="CHANNEL";var h=function(){function e(e){this._connection=e,r.register(o.CONNECT,this.onConnect.bind(this)),r.register(o.DISCONNECT,this.onDisconnect.bind(this)),r.register(o.OFFER,this.onOffer.bind(this)),r.register(o.ANSWER,this.onAnswer.bind(this)),r.register(o.CANDIDATE,this.onCandidate.bind(this))}return Object.defineProperty(e.prototype,"connection",{get:function(){return this._connection},set:function(e){this._connection=e},enumerable:!0,configurable:!0}),e.prototype.onConnect=function(e){var n=this,t=c.get(this._connection.servers,e),r=s.get(t,this._connection.dataConstraints);this.dispatchPeer(t,e),this.dispatchChannel(r,e),this._connection.addChannel(e.caller.id,r),this._connection.addPeer(e.caller.id,t),t.createOffer(function(r){var i={type:o.OFFER,caller:null,callee:e.caller,room:e.room,data:r};t.setLocalDescription(r,function(){return n.dispatchEvent(i)},function(t){return n.dispatchError(e,t)})},function(t){return n.dispatchError(e,t)})},e.prototype.onDisconnect=function(e){this._connection.removeChannel(e.caller.id),this._connection.removePeer(e.caller.id)},e.prototype.onOffer=function(e){var n=this,t=c.get(this._connection.servers,e);this._connection.addPeer(e.caller.id,t),this.dispatchPeer(t,e),t.ondatachannel=function(t){n.dispatchChannel(t.channel,e),n._connection.addChannel(e.caller.id,t.channel)},t.setRemoteDescription(new RTCSessionDescription(e.data),function(){},function(t){return n.dispatchError(e,t)}),t.createAnswer(function(r){var i={type:o.ANSWER,caller:null,callee:e.caller,room:e.room,data:r};t.setLocalDescription(r,function(){return n.dispatchEvent(i)},function(t){return n.dispatchError(e,t)})},function(t){return n.dispatchError(e,t)})},e.prototype.onAnswer=function(e){var n=this;this._connection.getPeer(e.caller.id).setRemoteDescription(new RTCSessionDescription(e.data),function(){},function(t){return n.dispatchError(e,t)})},e.prototype.onCandidate=function(e){var n=this,t=this._connection.getPeer(e.caller.id),r=new RTCIceCandidate(e.data);t.addIceCandidate(r).then(function(){},function(t){return n.dispatchError(e,t)})},e.prototype.dispatchPeer=function(e,n){var t={caller:n.caller,room:n.room,data:e};r.dispatch(a.PEER,t)},e.prototype.dispatchChannel=function(e,n){var t={caller:n.caller,room:n.room,data:e};r.dispatch(a.CHANNEL,t)},e.prototype.dispatchEvent=function(e){r.dispatch("send",e)},e.prototype.dispatchError=function(e,n){var t={caller:e.caller,room:e.room,data:n.message};r.dispatch(a.ERROR,t)},e}(),u=function(){function e(e,n){void 0===e&&(e={}),void 0===n&&(n=null);var t=new i(e,n);this.bridge=new h(t)}return e.prototype.on=function(e,n){r.register(e,n)},e.prototype.send=function(e,n){if(n){var t=this.bridge.connection.channels[n];t&&"open"===t.readyState&&t.send(e)}else Object.entries(this.bridge.connection.channels).forEach(function(n){var t=(n[0],n[1]);"open"===t.readyState&&t.send(e)})},e.prototype.connect=function(e){var n={type:o.CONNECT,caller:null,callee:null,room:{id:e},data:null};r.dispatch("send",n)},e.prototype.disconnect=function(e){var n=this.bridge.connection;Object.entries(n.channels).forEach(function(e){var t=e[0];e[1];return n.removeChannel(t)}),Object.entries(n.peers).forEach(function(e){var t=e[0];e[1];return n.removePeer(t)});var t={type:o.DISCONNECT,caller:null,callee:null,room:{id:e},data:null};r.dispatch("send",t)},e.prototype.peers=function(e){return e?this.bridge.connection.peers[e]:this.bridge.connection.peers},e.prototype.channels=function(e){return e?this.bridge.connection.channels[e]:this.bridge.connection.channels},e}(),p=function(){function e(e){this.socket=n.connect(e),r.register("send",this.onSend.bind(this)),this.subscribeEvents()}return e.prototype.onSend=function(e){this.socket.emit("message",e)},e.prototype.subscribeEvents=function(){this.socket.on("message",this.onMessage.bind(this)),this.socket.on("ipaddr",this.onIp.bind(this)),this.socket.on("log",this.onLog.bind(this))},e.prototype.onIp=function(e){r.dispatch(a.LOG,"Server IP address is: "+e)},e.prototype.onLog=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.dispatch(a.LOG,e)},e.prototype.onMessage=function(e){r.dispatch(e.type,e)},e}();e.default=u,e.EventDispatcher=r,e.AppEventType=a,e.SignalingEventType=o,e.SocketChannel=p,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("socket.io-client")):"function"==typeof define&&define.amd?define(["exports","socket.io-client"],n):n(e["peer-data"]=e["peer-data"]||{},e.io)}(this,function(e,n){"use strict";var t={},r=function(){function e(){}return e.register=function(e,n){t[e]||(t[e]=[]),t[e].push(n)},e.dispatch=function(e,n){t[e].forEach(function(e){return e(n)})},e}(),o=function(){function e(){}return e}();o.CONNECT="CONNECT",o.DISCONNECT="DISCONNECT",o.CANDIDATE="CANDIDATE",o.OFFER="OFFER",o.ANSWER="ANSWER",o.ERROR="ERROR";var i=function(){function e(e,n){void 0===e&&(e={}),void 0===n&&(n=null),this._servers={},this._dataConstraints=null,this._peers={},this._channels={},this._servers=e,this._dataConstraints=n}return Object.defineProperty(e.prototype,"peers",{get:function(){return this._peers},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"channels",{get:function(){return this._channels},enumerable:!0,configurable:!0}),e.prototype.addPeer=function(e,n){var t=this;return this._peers.hasOwnProperty(e)||(this._peers[e]=n,n.onconnectionstatechange=function(r){"closed"===n.connectionState&&t.removePeer(e)}),this},e.prototype.getPeer=function(e){return this._peers.hasOwnProperty(e)?this._peers[e]:null},e.prototype.removePeer=function(e){return this._peers.hasOwnProperty(e)&&(this._peers[e].close(),delete this._peers[e]),this},e.prototype.addChannel=function(e,n){var t=this;return this._channels.hasOwnProperty(e)||(this._channels[e]=n,n.onclose=function(n){return t.removeChannel(e)}),this},e.prototype.getChannel=function(e){return this._channels.hasOwnProperty(e)?this._channels[e]:null},e.prototype.removeChannel=function(e){return this._channels.hasOwnProperty(e)&&(this._channels[e].close(),delete this._channels[e]),this},Object.defineProperty(e.prototype,"servers",{get:function(){return this._servers},set:function(e){this._servers=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataConstraints",{get:function(){return this._dataConstraints},set:function(e){this._dataConstraints=e},enumerable:!0,configurable:!0}),e}(),c=function(){function e(){}return e.get=function(e,n){var t=new RTCPeerConnection(e);return t.onicecandidate=function(e){if(e.candidate){var t={type:o.CANDIDATE,caller:null,callee:n.caller,room:n.room,data:e.candidate};r.dispatch("send",t)}},t},e}(),s=function(){function e(){}return e.get=function(e,n){var t=Math.floor(1e16*(1+Math.random())).toString(16).substring(1);return e.createDataChannel(t,n)},e}(),a=function(){function e(){}return e}();a.LOG="LOG",a.ERROR="ERROR",a.PEER="PEER",a.CHANNEL="CHANNEL";var h=function(){function e(e){this._connection=e,r.register(o.CONNECT,this.onConnect.bind(this)),r.register(o.DISCONNECT,this.onDisconnect.bind(this)),r.register(o.OFFER,this.onOffer.bind(this)),r.register(o.ANSWER,this.onAnswer.bind(this)),r.register(o.CANDIDATE,this.onCandidate.bind(this))}return Object.defineProperty(e.prototype,"connection",{get:function(){return this._connection},set:function(e){this._connection=e},enumerable:!0,configurable:!0}),e.prototype.onConnect=function(e){var n=this,t=c.get(this._connection.servers,e),r=s.get(t,this._connection.dataConstraints);this.dispatchPeer(t,e),this.dispatchChannel(r,e),this._connection.addChannel(e.caller.id,r),this._connection.addPeer(e.caller.id,t),t.createOffer(function(r){var i={type:o.OFFER,caller:null,callee:e.caller,room:e.room,data:r};t.setLocalDescription(r,function(){return n.dispatchEvent(i)},function(t){return n.dispatchError(e,t)})},function(t){return n.dispatchError(e,t)})},e.prototype.onDisconnect=function(e){this._connection.removeChannel(e.caller.id),this._connection.removePeer(e.caller.id)},e.prototype.onOffer=function(e){var n=this,t=c.get(this._connection.servers,e);this._connection.addPeer(e.caller.id,t),this.dispatchPeer(t,e),t.ondatachannel=function(t){n.dispatchChannel(t.channel,e),n._connection.addChannel(e.caller.id,t.channel)},t.setRemoteDescription(new RTCSessionDescription(e.data),function(){},function(t){return n.dispatchError(e,t)}),t.createAnswer(function(r){var i={type:o.ANSWER,caller:null,callee:e.caller,room:e.room,data:r};t.setLocalDescription(r,function(){return n.dispatchEvent(i)},function(t){return n.dispatchError(e,t)})},function(t){return n.dispatchError(e,t)})},e.prototype.onAnswer=function(e){var n=this;this._connection.getPeer(e.caller.id).setRemoteDescription(new RTCSessionDescription(e.data),function(){},function(t){return n.dispatchError(e,t)})},e.prototype.onCandidate=function(e){var n=this,t=this._connection.getPeer(e.caller.id),r=new RTCIceCandidate(e.data);t.addIceCandidate(r).then(function(){},function(t){return n.dispatchError(e,t)})},e.prototype.dispatchPeer=function(e,n){var t={caller:n.caller,room:n.room,data:e};r.dispatch(a.PEER,t)},e.prototype.dispatchChannel=function(e,n){var t={caller:n.caller,room:n.room,data:e};r.dispatch(a.CHANNEL,t)},e.prototype.dispatchEvent=function(e){r.dispatch("send",e)},e.prototype.dispatchError=function(e,n){var t={caller:e.caller,room:e.room,data:n.message};r.dispatch(a.ERROR,t)},e}(),u=function(){function e(e,n){void 0===e&&(e={}),void 0===n&&(n=null);var t=new i(e,n);this.bridge=new h(t)}return e.prototype.on=function(e,n){r.register(e,n)},e.prototype.send=function(e,n){if(n){var t=this.bridge.connection.channels[n];t&&"open"===t.readyState&&t.send(e)}else Object.entries(this.bridge.connection.channels).forEach(function(n){n[0];var t=n[1];"open"===t.readyState&&t.send(e)})},e.prototype.connect=function(e){var n={type:o.CONNECT,caller:null,callee:null,room:{id:e},data:null};r.dispatch("send",n)},e.prototype.disconnect=function(e){var n=this.bridge.connection;Object.entries(n.channels).forEach(function(e){var t=e[0];e[1];return n.removeChannel(t)}),Object.entries(n.peers).forEach(function(e){var t=e[0];e[1];return n.removePeer(t)});var t={type:o.DISCONNECT,caller:null,callee:null,room:{id:e},data:null};r.dispatch("send",t)},e.prototype.peers=function(e){return e?this.bridge.connection.peers[e]:this.bridge.connection.peers},e.prototype.channels=function(e){return e?this.bridge.connection.channels[e]:this.bridge.connection.channels},e}(),p=function(){function e(e){this.socket=n.connect(e),r.register("send",this.onSend.bind(this)),this.subscribeEvents()}return e.prototype.onSend=function(e){this.socket.emit("message",e)},e.prototype.subscribeEvents=function(){this.socket.on("message",this.onMessage.bind(this)),this.socket.on("ipaddr",this.onIp.bind(this)),this.socket.on("log",this.onLog.bind(this))},e.prototype.onIp=function(e){r.dispatch(a.LOG,"Server IP address is: "+e)},e.prototype.onLog=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.dispatch(a.LOG,e)},e.prototype.onMessage=function(e){r.dispatch(e.type,e)},e}();e.default=u,e.EventDispatcher=r,e.AppEventType=a,e.SignalingEventType=o,e.SocketChannel=p,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=peer-data.js.map
{
"name": "peer-data",
"version": "1.2.4",
"version": "1.2.5",
"description": "PeerData - library for files, media streaming/sharing using WebRTC",

@@ -58,3 +58,3 @@ "scripts": {

"@types/jest": "^19.2.3",
"@types/node": "^7.0.18",
"@types/node": "^7.0.22",
"@types/socket.io-client": "^1.4.29",

@@ -64,3 +64,3 @@ "@types/webrtc": "^0.0.21",

"dts-bundle": "^0.7.2",
"jest": "^20.0.3",
"jest": "^20.0.4",
"jest-environment-node-debug": "^2.0.0",

@@ -74,8 +74,8 @@ "rimraf": "^2.6.1",

"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-uglify": "^1.0.2",
"rollup-plugin-uglify": "^2.0.1",
"semver": "^5.3.0",
"ts-jest": "^20.0.4",
"tslib": "^1.7.1",
"tslint": "^5.2.0",
"typescript": "^2.3.2"
"tslint": "^5.3.2",
"typescript": "^2.3.3"
},

@@ -82,0 +82,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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