New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ocbesbn-redis-events

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ocbesbn-redis-events

Module simplifying access to the publish/subscribe system provided by Redis.

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-76.47%
Maintainers
1
Weekly downloads
 
Created
Source

ocbesbn-redis-events

Coverage Status Build status

This module provides simplified access to the publish/subscribe system provided by Redis. It uses Consul in order to determine the required Redis server endpoint and further configurations. To have a look at the full API, please visit the related wiki page.

Minimum setup

First got to your local code directory and run:

npm install ocbesbn-redis-events

To go with the minimum setup, you need to have access to a running Consul server to get your endpoint configuration for Redis. In addition, a Redis server is required which has to be registered inside Consul. If Redis password authentication is required, Consul has to provide the configuration key {{your-service-name}}/redis/password where {{your-service-name}} is the least name of the directory your code runs in. If authentication is not used, you can set the consul.redisPasswordKey to null or false when creating a new instance of RedisEvents.

If all this is set up, go to you code and add the following lines:

const RedisEvents = require('ocbesbn-redis-events');

var events = new RedisEvents({ consul : { host : '{{your-consul-host}}' } });

// Subscribe to a channel by name.
events.subscribe('my-channel', console.log).then(() => events.emit('Hello, world!', 'my-channel'));
// - OR -
// Subscribe to a channel by pattern.
events.subscribe('my-channel.*', console.log).then(() => events.emit('Hello, world!', 'my-channel.sub-channel'));

// Close all Redis connections.
events.disposeAll();

Default configuration

The default configuration object provides hints about what the module's standard behavior is like.

{
    serializer : JSON.stringify,
    parser : JSON.parse,
    defaultEmitChannel : null,
    consul : {
        host : 'consul',
        redisServiceName  : 'redis',
        redisPasswordKey : 'redis/password'
    },
    context : {
    }
}

Keywords

FAQs

Package last updated on 18 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc