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.0.20 to 1.0.21

5

lib/app/app.d.ts
import { EventType } from './data-channel/event-type';
import { Logger } from './logger/logger';
import { Signaling } from './signaling/signaling';
import { Connection } from './connection/connection';
export declare class App {
private bridge;
private _connection;
private _signalling;
constructor();
constructor(servers?: RTCConfiguration, dataConstraints?: RTCDataChannelInit);
on(event: EventType, callback: EventHandler): void;

@@ -18,3 +16,2 @@ send(data: any, ids?: string[]): void;

signalling: Signaling;
connection: Connection;
}

31

lib/app/app.js

@@ -9,5 +9,6 @@ "use strict";

class App {
constructor() {
this._connection = new connection_1.Connection();
this.bridge = new bridge_1.Bridge(this.connection, new console_logger_1.ConsoleLogger(log_level_1.LogLevel.ERROR));
constructor(servers = {}, dataConstraints = null) {
const connection = new connection_1.Connection(servers, dataConstraints);
const logger = new console_logger_1.ConsoleLogger(log_level_1.LogLevel.ERROR);
this.bridge = new bridge_1.Bridge(connection, logger);
}

@@ -18,3 +19,3 @@ on(event, callback) {

send(data, ids) {
Object.entries(this._connection.channels)
Object.entries(this.bridge.connection.channels)
.forEach(([key, value]) => {

@@ -36,14 +37,14 @@ if (!ids || (ids.length > 1 && ids.indexOf(key) !== -1)) {

disconnect(ids) {
Object.entries(this._connection.channels)
Object.entries(this.bridge.connection.channels)
.forEach(([key, value]) => {
if (!ids || (ids.length > 1 && ids.indexOf(key) !== -1)) {
value.close();
delete this._connection.channels[key];
delete this.bridge.connection.channels[key];
}
});
Object.entries(this._connection.peers)
Object.entries(this.bridge.connection.peers)
.forEach(([key, value]) => {
if (!ids || (ids.length > 1 && ids.indexOf(key) !== -1)) {
value.close();
delete this._connection.peers[key];
delete this.bridge.connection.peers[key];
let event = {

@@ -60,12 +61,12 @@ type: event_type_1.SignalingEventType.DISCONNECT,

get servers() {
return this.bridge.servers;
return this.bridge.connection.servers;
}
set servers(value) {
this.bridge.servers = value;
this.bridge.connection.servers = value;
}
get dataConstraints() {
return this.bridge.dataConstraints;
return this.bridge.connection.dataConstraints;
}
set dataConstraints(value) {
this.bridge.dataConstraints = value;
this.bridge.connection.dataConstraints = value;
}

@@ -84,10 +85,4 @@ get logger() {

}
get connection() {
return this._connection;
}
set connection(value) {
this._connection = value;
}
}
exports.App = App;
//# sourceMappingURL=app.js.map

@@ -6,5 +6,2 @@ import { SignalingEvent } from './signaling/event';

export declare class Bridge {
private label;
private _servers;
private _dataConstraints?;
private _connection;

@@ -18,6 +15,4 @@ private _logger;

onDisconnect(event: SignalingEvent): void;
servers: RTCConfiguration;
dataConstraints: RTCDataChannelInit;
connection: Connection;
logger: Logger;
}

@@ -5,7 +5,5 @@ "use strict";

const factory_2 = require('./data-channel/factory');
const LABEL = 'chunks';
class Bridge {
constructor(connection, logger) {
this.label = 'chunks';
this._servers = {};
this._dataConstraints = null;
this._connection = connection;

@@ -15,4 +13,4 @@ this._logger = logger;

onConnect(event, signalling) {
let peer = this._connection.peers[event.caller.id] = factory_1.PeerFactory.get(this._servers, signalling);
let channel = peer.createDataChannel(this.label, this._dataConstraints);
let peer = this._connection.peers[event.caller.id] = factory_1.PeerFactory.get(this._connection.servers, signalling);
let channel = peer.createDataChannel(LABEL, this._connection.dataConstraints);
this._connection.channels[event.caller.id] = factory_2.DataChannelFactory.get(channel);

@@ -36,3 +34,3 @@ peer.createOffer((desc) => {

onOffer(event, signalling) {
let peer = this._connection.peers[event.caller.id] = factory_1.PeerFactory.get(this._servers, signalling);
let peer = this._connection.peers[event.caller.id] = factory_1.PeerFactory.get(this._connection.servers, signalling);
peer.ondatachannel = (dataChannelEvent) => {

@@ -64,14 +62,2 @@ this._connection.addChannel(event.caller.id, factory_2.DataChannelFactory.get(dataChannelEvent.channel));

}
get servers() {
return this._servers;
}
set servers(value) {
this._servers = value;
}
get dataConstraints() {
return this._dataConstraints;
}
set dataConstraints(value) {
this._dataConstraints = value;
}
get connection() {

@@ -78,0 +64,0 @@ return this._connection;

import { PeerCollection } from '../peer/collection';
import { DataChannelCollection } from '../data-channel/collection';
export declare class Connection {
private _servers;
private _dataConstraints?;
private _peers;
private _channels;
constructor(servers?: RTCConfiguration, dataConstraints?: RTCDataChannelInit);
readonly peers: PeerCollection;

@@ -12,2 +15,4 @@ readonly channels: DataChannelCollection;

removeChannel(id: string): Connection;
servers: RTCConfiguration;
dataConstraints: RTCDataChannelInit;
}
"use strict";
class Connection {
constructor() {
constructor(servers = {}, dataConstraints = null) {
this._servers = {};
this._dataConstraints = null;
this._peers = {};
this._channels = {};
this._servers = servers;
this._dataConstraints = dataConstraints;
}

@@ -40,4 +44,16 @@ get peers() {

}
get servers() {
return this._servers;
}
set servers(value) {
this._servers = value;
}
get dataConstraints() {
return this._dataConstraints;
}
set dataConstraints(value) {
this._dataConstraints = value;
}
}
exports.Connection = Connection;
//# sourceMappingURL=connection.js.map

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

import { App } from './app/app';
declare const PeerData: App;
import { App as PeerData } from './app/app';
export default PeerData;

@@ -4,0 +3,0 @@ export { Signaling } from './app/signaling/signaling';

"use strict";
const app_1 = require('./app/app');
const PeerData = new app_1.App();
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = PeerData;
exports.default = app_1.App;
var log_level_1 = require('./app/logger/log-level');

@@ -7,0 +6,0 @@ exports.LogLevel = log_level_1.LogLevel;

{
"name": "peer-data",
"version": "1.0.20",
"version": "1.0.21",
"description": "PeerData - library for files, media streaming/sharing using WebRTC",

@@ -5,0 +5,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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