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

espial

v0.5.0

Published

A secure distributed event layer for nodejs applications

Downloads

24

Readme

espial

##About

###Description Espial is a secure distributed event layer, specifically written to be leveraged in nodejs applications.

By default, it uses multicast to find other nodes running Espial and automatically joins the existing cluster. Running in an environment which does not support multicast? Simply let Espial know, and it will perform manual peer discovery.

Espial exposes a standard set of events which can be listened for, such as the election of a new master, addition of a new node, removal of a node, as well as master promotion and demotion. It also allows applications to register custom events and respond to them. More on this below.

Ultimately, Espial was written to encourage the creation of highly available applications, without the need to run additional servers, such as a database, to share state. When your application needs to scale out, it performs auto-discovery to add the new nodes; no need to search for a list of peers. Simply fire messages from your application and let Espial handle the heavy lifting.

###Author

##Getting Started

###Installation npm install espial

###Configuration

##Features

###Events The following are core events provided by Espial. These events cannot be overwritten by custom user events.

  • listening - emits when Espial has started
  • added_node - emits on exiting nodes when a new node enters the cluster
  • removed_node - emits on nodes when another node leaves the cluster
  • node_accepted - emits on a new node if it was accepted to the cluster
  • node_rejected - emits on a new node if it was rejected from the cluster
  • new_master - emits when a new master has been elected
  • promotion - emits when this node is promoted to master
  • demotion - emits when this node is demoted from master

Custom user events can be registered and listened for like any core event. To start listening for a specific event, call espial.join("event_name"). Similarly, when espial should no longer care about a custom event, simply remove the event listener by calling espial.leave("event_name").

###Security By default, any node can connect to an existing Espial cluster. Since this may not be desirable, filters can be enforced which require a connecting node to meet certain criteria, before being added to the cluster. After configuring your node, simply call espial.connection_filter(fn), passing it a function which executes a callback with a boolean value. If the callback returns true, the node is accepted, otherwise it is rejected. For example, the following filter will only accept nodes if their hostname ends with "org.internal":

var Espial = require("espial");
var espial = new Espial();

espial.connection_filter(function(data, fn){
    return fn(data.host.match(/org.internal$/g) != null);
});

Once a node is connected to the cluster, Espial encrypts all traffic using 128-bit aes-gcm authenticated encryption. The aes key used is unique for each pair of nodes, and is generated using Diffie-Hellman key exchange upon connection. Initialization vectors are never reused. Since Espial does not require a pre-shared key to perform encryption, there is no fear of having that key compromised. Additionally, key rotation is made easy by simply restarting the node.