npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

kognijs-rsb

v0.3.1

Published

KogniHome Web Toolkit RSB module

Readme

KogniJS - RSB Build Status Coverage Status

Wraps the Web Application Messaging Protocol (WAMP) and Protocol Buffers into a web version of the Robotic Service Bus (RSB). WAMP is kindly provided by autobahn and Protocol Buffers are provided by protobuf.js.

This module is part of the KogniJSframework. It is developed within the KogniHome project to help developers to create tailored and flexible interfaces for smart home environments.

Requirements

To work with WAMP, a server is needed such as crossbar which does understand the protocol. If you want to connect to an RSB network you will need the kogniserver which builds upon crossbar.

Getting Started

NPM

npm install kognijs-rsb

In your javascript file require the module and create an instance to be used:

var RSB = require('kognijs-rsb');
var rsb = new RSB();

Bower or CDN

REMARK: This version is minified and packages all dependencies (autobahn and protobuf.js) as well as their dependencies. Install the module via Bower and add dependencies with wiredep for instance:

bower install kognijs-rsb

You can include kognijs-rsb directly in your HTML file:

<script src="https://cdn.rawgit.com/aleneum/kognijs-rsb/v0.2.1/redist/kognijs.rsb.min.js"></script>

The RSB object resides in the KogniJS namespace:

var RSB = KogniJS.RSB;
var rsb = new RSB();

Usage

Make sure that your crossbar and kogniserver are running.

Connect to the server

Connect to the server. url could be localhost:8181 for instance. The callback method is called when the connection is established and Listeners and Informers can be created.

rsb.connect(url, function() {
  // is called when the connection was established
  // do your rsb stuff here
  // create as much listeners and informers as you like
});

Listen to Messages

Scopes can be set as strings like in any other implementation of RSB. Possible types are native types such as RSB.STRING, RSB.INTEGER, RSB.FLOAT (or RSB.DOUBLE) or RST types like "rst.generic.Value". The callback value is either a js native type or an object representing the Protocol Buffer derived from RST.


// listen to primitive type
rsb.createListener({
  scope: "/rsb/web/tour/string",
  type: RSB.STRING,
  callback: function(value) {
    console.log(value)
  }
});

// listen to RST type
rsb.createListener({
  scope: "/rsb/web/tour/value",
  type: "rst.generic.Value",
  callback: function(value) {
    console.log(value)
  }
});

Publish Messages

While listening is handled by the global rsb instance, publishers have to be handled manually. This design decision allows a more flexible and also familiar way of sending messages.

var pub = rsb.createInformer({
  scope: "/rsb/web/tour/keyvaluepair",
  type: "rst.generic.KeyValuePair",
  callback: function() {
    pub.publish({
      key:"foo",
      value: {type: 4, string: 'bar'}
    })
  }
});

This looks a bit confusing because we have a return value AND (optionally) a callback. The method createInfomer returns a RSBInformer synchronously but the scope registration happens asynchronously. If you plan to use your informer right away you can stick to the code above and use the callback which is called once the scope is registered. If you just want to create an informer callback can also be an empty method.

Interactive Demo

An interactive demo can be started with npm and gulp:

git clone https://github.com/aleneum/kognijs-rsb.git kognijs-rsb
cd kognijs-rsb
npm ci  # install package versions found in package-lock
npm run dev  # runs gulp test server

A browser window should open to localhost:3000 with an interactive tour. This demo requires a running kogniserver instance.

Acknowledgements

The development of this software was supported through project grants KogniHome (German Federal Ministry of Education and Research (BMBF) grant no. 16SV7054K) at Bielefeld University.