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

@browser-network/network

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@browser-network/network - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

18

dist/src/index.js

@@ -137,3 +137,3 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

maxMessageRateBeforeRude: Infinity,
maxConnections: 10
maxConnections: 5
}, config);

@@ -319,9 +319,16 @@ this.switchboardService = new SwitchboardService_1.default({

switch (_a.label) {
case 0: return [4 /*yield*/, this.switchboardService.sendEmptyRequest()];
case 0:
// Don't even do the request if we've already reached our max,
// Just schedule the next one and be on our way.
if (this.activeConnections.length >= this.config.maxConnections) {
this._switchboardTimeout = setTimeout(function () { return _this.doSwitchboardRequest(); }, this.config.slowSwitchboardRequestInterval);
return [2 /*return*/];
}
return [4 /*yield*/, this.switchboardService.sendEmptyRequest()];
case 1:
resp = _a.sent();
this._emit('switchboard-response', resp);
numOffers = resp.negotiationItems.filter(function (item) { return item.negotiation.type === 'offer'; }).length;
numAnswers = resp.negotiationItems.filter(function (item) { return item.negotiation.type === 'answer'; }).length;
this._emit('connection-process', "received switchboard response with ".concat(numOffers, " offers and ").concat(numAnswers, " answers"));
this._emit('switchboard-response', resp);
newAnswerConnections = resp.negotiationItems.map(function (item) {

@@ -523,2 +530,7 @@ // Create a new answer connection for each foreign offer

case 0:
// We don't care who's around if we've maxed out our connections
if (this.activeConnections.length >= this.config.maxConnections) {
return [2 /*return*/];
}
// No need to do anything if we're already connected with this person
if (this.getActiveConnectionByAddress(message.address)) {

@@ -525,0 +537,0 @@ return [2 /*return*/];

8

dist/src/NetworkConfig.d.ts

@@ -37,3 +37,4 @@ export declare type NetworkConfig = {

* messages are we willing to accept from a node in one second before we consider them
* to be spamming us?
* to be spamming us? This defaults to Infinity, i.e. nobody will be considered rude
* no matter how frequently they send messages.
*/

@@ -45,8 +46,7 @@ maxMessageRateBeforeRude: number;

* or a totally connected network where all nodes are connected to all other
* nodes. If this was set to 3, the network would be essentially linear.
* nodes. If this was set to 2, the network would be essentially linear.
* However it also would be highly prone to partitions as geometric shapes would
* appear. Note this includes the ever present 'open connection', so if this is set
* to 2, the node will only want to find one other node to connect with.
* appear.
*/
maxConnections: number;
};
{
"name": "@browser-network/network",
"version": "0.3.1",
"version": "0.3.2",
"description": "A WebRTC based direct peer to peer network in the browser.",

@@ -5,0 +5,0 @@ "main": "./dist/src/index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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