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

simple-producer-consumer

v1.2.2

Published

A simple demo of producer and consumer node.js services

Downloads

15

Readme

simple-producer-consumer

js-standard-style Build Status Code Climate codecov.io Dependency Status devDependency Status

NPM

A project to demonstrate bi-directional asynchronous network communication between independent Node.js processes.

A generator process creates random arithmetic expressions of 1 to 3 operations (2 to 4 operands) and sends the JSON formatted representation of the expression to an evaluator process which computes the value and replies to the generator. The generator and the evaluator communicate via websockets (facilitated by the Socket.io library).

Demonstration

asciicast

Requirements

  • Node.js v4.0.0 or later

Usage

Option 1 - Run generator and evaluator processes locally on same machine

# Install the npm module globally (may need to run as root via sudo)
$ npm install simple-producer-consumer@latest -g
# Start the evaluator process
$ spc-evaluator
# Start the generator process (in a different terminal window)
$ spc-generator

Option 2 - Run the generator and connect to a hosted evaluator process running on an AWS EC2 server

# Install the npm module globally (may need to run as root via sudo)
$ npm install simple-producer-consumer@latest -g
# Start the generator process (in a different terminal window)
$ SPC_SERVER_HOST=ec2-52-35-48-3.us-west-2.compute.amazonaws.com spc-generator

Option 3 - Clone the repo, build the module and run without installing globally on your system

$ git clone [email protected]:cflynn07/simple-producer-consumer.git
$ cd ./simple-producer-consumer
$ npm install .
# Start the evaluator
$ npm run evaluator
# Start the generator
$ npm run generator

Tests

Unit tests use Mocha, Unit.js and Istanbul

$ npm run test
$ npm run test-html-cov # Will auto-open Google Chrome with test coverage data on OSX

Configuration

Configuration options can be overriden by enviroment variables. Default values are defined in configs/.env

SPC_EXPRESSION_DISPLAY_COUNT=10
SPC_GENERATOR_INTERVAL=250
SPC_LOG_LEVEL_STDOUT=none
SPC_SERVER_HOST=localhost
SPC_SERVER_PORT=3001

UML Diagrams

Sequence

UML_Sequence

License

MIT