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

@nephys/plexus

v3.0.0

Published

[![License](https://img.shields.io/github/license/Nephys/plexus?style=flat-square)](LICENSE) [![npm (scoped)](https://img.shields.io/npm/v/@nephys/plexus?style=flat-square)](https://www.npmjs.com/package/@nephys/plexus) [![node-current (scoped)](https:/

Downloads

8

Readme

Plexus

License npm (scoped) node-current (scoped)

Dependency-free decentralized peer-to-peer network for storage and communication based on the Kademlia distributed hash table.

Contents

Installing

npm install @nephys/plexus --save

Testing

npm run test

This test will create a 50-Node Local Mesh Network and then go through the 4 following steps.

Step | Description ------------ | ------------- Item lookup | Testing if nodes can find an item on the network Node lookup | Testing if nodes can find another node on the network Broadcasting test | Testing if a node can broadcast to the rest of the network Non existent item lookup | Testing if nodes dont find non existent data on the network*

* (The lookup should timemout and fail)
npm run chat

A demo CLI chat client to test communication between nodes.

npm run broadcast

Testing the broadcasting system between 3 node A, B & C where A & B know eachother, B & C know eachother as well and A & C don't know eachother but should be able to communicate regardless.

//  Expected output:

[A] b speaking
[C] b speaking
[B] a speaking
[B] c speaking
[C] a speaking
[A] c speaking

Quick Start

Creating a Plexus Node and joining the Mesh Network.

const plexus = require("plexus");

//  Node creation
const node = new plexus.Node({host: "127.0.0.1", port: 8080});    //  By default the host and port are 127.0.0.1:8080

//  Join the network
node.connect({host: "remote_ip", port: remote_port});

Storage

Storing and retrieving data on the Network.

//  Storing data
const item = node.store({key: key, value: value, republish: true});   //  If no key is provided it will default to the hash of the value stored

//  Retrieving data
const lookup = node.find({key: key});

//  The item exists on the Network
lookup.on("found", (result) => {
    console.log(result);
});

//  The item doesn't exist anywhere on the Network
lookup.on("timeout", () => {
    console.log("FIND request timed out");
});

Communication

Broadcasting to the whole Network.

(WIP, subject to forwarding loops under certain network conditions)
//  Sendind to the Network
node.broadcast({data: data});

//  Handling incoming Broadcasts
node.on("broadcast", (data) => {
    console.log(data);
});

Documentation

Resources

TODO

  • [X] ~~Implement keep alive (ping contacts to keep the UDP hole open)*~~
  • [X] ~~Implement Item expiration~~
  • [X] ~~Implement Item propagation~~
  • [X] ~~Improve the storage system~~
  • [X] ~~Clean up code~~
  • [X] ~~Finish implementing error handling using exceptions~~
  • [X] ~~Add documentation~~
  • [x] ~~Make broadcasting faster (master & slave broadcasting nodes?) Complete rework~~
~~* (WIP)~~

Support Me 🤝

If you like the project and want to support me you can do so by donating any amout to one of the following addresses or by using it in your own projects and sharing this repo.

Tank you! ❤️



@Nephys, 2021