publish-subscribe system for kad

Kad Quasar

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.quasarSubscribe('topic string', (content) => {

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


Kad Quasar extends Kadwith a publish/subscribesystem, 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 filterwhere 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 QuasarNodeclass decorates the KademliaNodeclass 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) contentobject. Those neighbors, in turn, relay the message to their neighbors in accordance with their view of the the network.


  • 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.


  • topic- (String) identifier for the topic
  • handler- (Function) receives arguments contentwith published data


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/.







  • 初探 Quasar

    个人博客:raptazure.github.io//post/17     偶然在 v2ex 看到一个关于 electronvue boilerplate 的帖子,评论区有人推荐了 quasar ...

    2 个月前
  • 使用Quasar设计Material和IOS风格的响应式网站

    GITHUB:使用Quasar设计旅游网站(https://github.com/whjin/makequasar) 文章链接:使用Quasar设计Material和IOS风格的响应式网站(htt...

    1 年前
  • quasar-framework cnodejs社区

    基于vue quasarframework(https://quasarframework.org)写的一个cnodejs社区,功能待完善中 技术平平前端小码农,代码如有不足之处望多指点。

    1 年前
  • quasar-framework

    Build responsive SPA, SSR, PWA, Hybrid Mobile Apps and Electron apps, all simultaneously using the s...

    5 个月前
  • quasar-extras

    Quasar Framework fonts, icons and animations Quasar Framework logo(https://cdn.rawgit.com/quasarfra...

    5 个月前
  • pikaday

    A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS Pikaday ======== NP...

    2 年前
  • pickadate.js

    pickadate.js是什么 什么是pickadate.js,The mobilefriendly, responsive, and lightweight jQuery date & ...

    2 年前
  • pickadate

    The composable date & time picker. pickadate.js The composable date & time picker 🕰 (ht...

    1 个月前
  • kad-traverse

    nat traversal extension for kad Kad Traverse ============ Build Status(https://img.shields.io/trav...

    9 天前
  • kad-spartacus

    spartacus attack mitigation plugin for kad Kad Spartacus ============= Build Status(https://img.sh...

    9 天前


扫码加入 JavaScript 社区