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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ndn-gremlin

v0.0.17

Published

ndn forwarder for node and browser

Downloads

5

Readme

NDN-Gremlin

NDN-Gremlin is a small, programmable Named Data Networking forwarding module for Node.js and the browser (via browserify). Use it to prototype NDN applications and experiment with network structures in pure Javascript.

Programmatic API features:

  • connect to other gremlins via websocket, webrtc, and tcp
  • listen for connection requests along a given namespace (in-band webrtc signaling)
  • callback based interest listeners (blocking or non-blocking)
  • interest/data forwarding and caching

for full list of methods, see the documentation

Usage

Note: NDN-gremlin is a bare-bones module providing low level interfaces to allow for the creation of highly customized forwarders. If you want to prototype an application really quickly, use NDN-IO, which includes a pre-configured gremlin, repository, and NDN Input/Output abstraction

Rather than provide a daemon to run from the command line, this 'gremlin' is designed to be used as a forwarding module within the context of a Node.js or Web-app.

Let's say you want a little gremlin running on the server, and you want clients in the browser to connect to it and be able to register a prefix on the server.

Currently, ndn-gremlin simply allows you to set a registrationPrefix on the client side and add a listener for that prefix on the remote side. Since the addition of a signed interest API in NDN-js, future versions will see a prefix-registration protocol more in line with that of NFD

In Node:

var Gremlin = require("ndn-gremlin")
  , gremlin = new Gremlin({
      ws: 1337     // default: 8585
      , tcp: 5555  // default: 8484
    });

gremlin.addListener({
    prefix: "myPrefix/register-prefix"
    , blocking: true
  }, function(interest, faceID, unblock){
    // interest.name.toUri() == "myPrefix/register-prefix/prefix/To/Register"
    gremlin.addRegisteredPrefix(interest.name.getSubName(2).toUri(), faceID)
  })

In the Browser:

var Gremlin = require("ndn-gremlin")
  , gremlin = new Gremlin();

gremlin.setRegistrationPrefix("myPrefix/register-prefix")

gremlin.addConnection("ws://" + location.hostname + ":1337", function onOpen(faceID){
    console.log("face " + faceId + "opened");
    gremlin.registerPrefix("prefix/To/Register", faceID);
  }, function onClosed(faceId){
    console.log("face " + faceId + "closed");
  });

Now lets say you want your clients to use your NDN network as a signaling channel for webRTC datachannels:

client 1:

var maxConnectionsOnPrefix = 3
gremlin.addConnectionListener("webrtc/ndn/", maxConnectionsOnPrefix, function onNewFace(faceID){
  console.log("got new webRTC face " + faceID);
  })

client 2:

gremlin.requestConnection("webrtc/ndn", function onOpen(faceID){
  console.log("got new face from connection request!" + faceID);
  })

License

Copywrite Colorado State University; Ryan Bennett.

LGPLv3