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

node-redis-rpc-fix

v1.0.5

Published

node-redis-rpc using node-redis-pubsub-fix with memory leak fix

Downloads

1

Readme

NRR (node redis RPC)

Simple rpc for node using redis. This library extends node redis pubsub and uses its feature as a base. It uses the existing methods on/subscribe / emit/publish to realize a simple rpc over redis and between node.js instances. Every node.js instance can connect to the event bus, listen to the bus via pub/sub or register/trigger rpc calls.

npm package Dependency Status devDependency Status code climate Coverage Status Travis CI

Important Changes

  • 1.0.8 update README.md & .npmignore file
  • 1.0.7 updated dependencies
  • 1.0.6 removed automatic npm publish from travis
  • 1.0.5 updated gruntfile build process, added more comments
  • 1.0.4 added redis server to the travis build environment (for tests only)
  • 1.0.3 adjusted travis config and unit tests
  • 1.0.2 minor changes, added status icons, added travis support
  • 1.0.0 first commit

Install

$ npm install node-redis-rpc

Usage

Setup

var NodeRedisRpc = require('node-redis-rpc');
var config = {
    host: 'localhost', // redis server hostname
    port: 6379,        // redis server port
    auth: 'password',  // optional password
    scope: 'test'      // use scope to prevent sharing messages between "node redis rpc"
};
var nodeRedisRpcInst = new NodeRedisRpc(config);

Simple rpc

// Register a listener on the channel "foo:bar" [1]
nodeRedisRpcInst.on('foo:bar', function (data, channel, done) {
    // do s.th. ...
    
    // Trigger done handler to fire back rpc result [2]
    // - first arg:  error status
    // - second arg: result data
    done(null, {num: 123, ary: [1,2,3,4], text: 'hello'});
});

/**
 * RPC callback handler [3]
 *
 * @param {null|*} err    error status
 * @param {*}      result result data returned by the rpc callback (see [2])
 */
var myRpcCallback = function (err, result) {
    console.log('err', err);       // outputs: 'null'
    console.log('result', result); // outputs: '{foo: 'bar', num: 123}'
};

// Trigger an event on the channel "foo:bar" (received by [1])
nodeRedisRpcInst.emit(
    'foo:bar',      // channel
    {name: 'Hans'}, // message data
    {               // options
        type: 'rpc',            // trigger an event of type "rpc"
        callback: myRpcCallback // register a callback handler [3] to be executed when the rpc result returns
    }
);

More

Please see node redis pubsub for more information on how to use this package's base package e.g. unsubscrbe to a channel.