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.2.0 to 0.3.0

2

dist/src/index.d.ts

@@ -57,3 +57,2 @@ import * as t from './types.d';

private _messageMemory;
private _switchboardVolunteerDelayTimeout;
private _switchboardTimeout;

@@ -165,3 +164,2 @@ private _presenceBroadcastInterval;

private handleLogMessage;
private handleSwitchboardVolunteerMessage;
private registerConnection;

@@ -168,0 +166,0 @@ private garbageCollect;

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

garbageCollectInterval: 1000 * 5,
respectSwitchboardVolunteerMessages: true,
maxMessageRateBeforeRude: Infinity,

@@ -201,3 +200,3 @@ maxConnections: 10

this.stopGarbageCollectionInterval();
clearTimeout(this._switchboardVolunteerDelayTimeout);
this.stopSwitchboardRequests();
for (var _i = 0, _a = this.connections; _i < _a.length; _i++) {

@@ -207,5 +206,2 @@ var c = _a[_i];

}
for (var conId in this._connections) {
delete this._connections[conId];
}
this._eventEmitter.removeAllListeners();

@@ -503,5 +499,2 @@ };

break;
case 'switchboard-volunteer':
this.handleSwitchboardVolunteerMessage(massage);
break;
default:

@@ -631,8 +624,2 @@ (0, util_1.exhaustive)(massage, 'Someone sent a message with our appId but of the wrong type!');

};
Network.prototype.handleSwitchboardVolunteerMessage = function (message) {
if (!this.config.respectSwitchboardVolunteerMessages) {
console.info('Switchboard Volunteer Message heard but feature is disabled. Heard from:', message.address);
return;
}
};
Network.prototype.registerConnection = function (connection) {

@@ -639,0 +626,0 @@ var _this = this;

@@ -48,14 +48,2 @@ import * as t from './types.d';

/**
* This message we will send into the network to tell everyone else that we are
* going to take the next turn of regularly communicating with the switchboard for a spell.
* If enabled, upon hearing this, the node will back off and stop sending switchboard requests
* until the specified timeout has elapsed.
*/
export declare type SwitchboardVolunteerMessage = Message<{}> & {
appId: string;
type: 'switchboard-volunteer';
ttl: 2;
destination: '*';
};
/**
* This is a kind of holdover from early development days but still seems to be usefully

@@ -75,2 +63,2 @@ * helping. The contents of this message will be logged to the console of whoever hears

*/
export declare type NetworkMessage = PresenceMessage | OfferMessage | AnswerMessage | LogMessage | SwitchboardVolunteerMessage;
export declare type NetworkMessage = PresenceMessage | OfferMessage | AnswerMessage | LogMessage;

@@ -33,10 +33,2 @@ export declare type NetworkConfig = {

/**
* Do we stop sending messages to a switchboard if we get a volunteer message
* In an effort to further reduce the already minimal load to a switchboard,
* I've come up with a somewhat cocamamy scheme to have only one node on
* a network be hitting the switchboard at a time. The rest of the connections
* to the network come from the message level.
*/
respectSwitchboardVolunteerMessages: boolean;
/**
* How often can a machine send us a message before we call them rude

@@ -43,0 +35,0 @@ * We don't want to stay connected to a node that's misbehaving - sending us

2

package.json
{
"name": "@browser-network/network",
"version": "0.2.0",
"version": "0.3.0",
"description": "A WebRTC based direct peer to peer network in the browser.",

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

@@ -264,3 +264,2 @@ # Browser Network

garbageCollectInterval: 1000 * 5,
respectSwitchboardVolunteerMessages: false,
maxMessageRateBeforeRude: 1000,

@@ -267,0 +266,0 @@ maxConnections: 10

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