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

kad-quasar

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kad-quasar

publish-subscribe system for kad

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-76.47%
Maintainers
1
Weekly downloads
 
Created
Source

Kad Quasar

Build Status Coverage Status NPM

Distributed publish-subscribe plugin for Kad, based on Quasar.

Quick Start

Install kad-quasar with NPM:

npm install kad-quasar --save

Plugin to your existing Kad project:

const kad = require('kad');
const quasar = require('kad-quasar');
const node = kad({ /* options */ });

node.plugin(quasar);

node.quasarSubscribe('topic string', (content) => {
  node.logger.info(content);
});

node.quasarPublish('topic string', {
  some: 'content'
});

Overview

Kad Quasar extends Kad with a publish/subscribe system, enabling different applications to run on the same overlay network.

To do this, Kad Quasar uses the routing table's contact list to build an attenuated bloom filter where each filter in the series contains topics that your node and your neighbors are subscribed to represented in "hops" from your node.

This allows each node to maintain a view of what their neighbors are interested in 3 hops away. Published messages are relayed to neighbors probabilistically based on this knowledge and are appended with negative information to prevent duplication. This forms "gravity wells" in the network around groups who are interested in a given topic and serves to prevent flooding the network while still maintaining a high probability that the message will be delivered to all nodes interested.

Class: QuasarNode(options)

The QuasarNode class decorates the KademliaNode class in Kad. It creates and manages an attenuated bloom filter representing the different topics to which your neighboring nodes are subscribed.

node.quasarPublish(topic[, content])

Publishes a message to your nearest neighbors on the given topic (and optional) content object. Those neighbors, in turn, relay the message to their neighbors in accordance with their view of the the network.

Parameters
  • topic - (String) identifier for the topic
  • content - (Mixed) additional data describing the publication

node.quasarSubscribe(topic[, handler])

Updates our local attenuated bloom filter to reflect our interest in the topic and notifies our neighbors to relay publications matching the topic to us. In turn, our neighbors will provide us with their local bloom filter, so we can do the same.

Parameters
  • topic - (String) identifier for the topic
  • handler - (Function) receives arguments content with published data

License

Kad Quasar - Distributed publish-subscribe plugin for Kad
Copyright (C) 2017 Gordon Hall

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Keywords

FAQs

Package last updated on 24 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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