# @superbalist/js-pubsub-redis

> A Redis adapter for the js-pubsub package

Latest version **3.0.0** (published 2017-07-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @superbalist/js-pubsub-redis
pnpm add @superbalist/js-pubsub-redis
yarn add @superbalist/js-pubsub-redis
bun add @superbalist/js-pubsub-redis
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2017-07-18 |
| First published | 2017-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Superbalist.com a division of Takealot Online |
| Maintainers | bradwhittington, zoidbergwill, matthewgoslett |
| Keywords | pubsub, redis |

## Links

- npm: https://www.npmjs.com/package/@superbalist/js-pubsub-redis
- Repository: https://github.com/Superbalist/js-pubsub-redis
- Homepage: https://github.com/Superbalist/js-pubsub-redis#readme
- Issues: https://github.com/Superbalist/js-pubsub-redis/issues
- npm.io page: https://npm.io/package/@superbalist/js-pubsub-redis

## Dependencies (3)

- [redis](https://npm.io/package/redis.md) ^2.7.1
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.0
- [@superbalist/js-pubsub](https://npm.io/package/@superbalist/js-pubsub.md) ^3.0.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2017-07-18
- 2.0.0 — 2017-05-17
- 1.0.3 — 2017-05-16
- 1.0.2 — 2017-05-15
- 1.0.1 — 2017-05-09
- 1.0.0 — 2017-05-08
- 0.0.1 — 2017-05-02

## README

# @superbalist/js-pubsub-redis

A Redis adapter for the [js-pubsub](https://github.com/Superbalist/js-pubsub) package.

[![Author](http://img.shields.io/badge/author-@superbalist-blue.svg?style=flat-square)](https://twitter.com/superbalist)
[![Build Status](https://img.shields.io/travis/Superbalist/js-pubsub-redis/master.svg?style=flat-square)](https://travis-ci.org/Superbalist/js-pubsub-redis)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![NPM Version](https://img.shields.io/npm/v/@superbalist/js-pubsub-redis.svg)](https://www.npmjs.com/package/@superbalist/js-pubsub-redis)
[![NPM Downloads](https://img.shields.io/npm/dt/@superbalist/js-pubsub-redis.svg)](https://www.npmjs.com/package/@superbalist/js-pubsub-redis)


## Installation

```bash
npm install @superbalist/js-pubsub-redis
```
    
## Usage

```node
'use strict';

let redis = require('redis');
let RedisPubSubAdapter = require('@superbalist/js-pubsub-redis');

let client = redis.createClient({
  host: 'redis',
  port: 6379
});

let adapter = new RedisPubSubAdapter(client);

// consume messages
// note: this is a blocking call
adapter.subscribe('my_channel', (message) => {
  console.log(message);
  console.log(typeof message);
});

// publish messages
adapter.publish('my_channel', {first_name: 'Matthew'});
adapter.publish('my_channel', 'Hello World');

// publish multiple messages
let messages = [
  'message 1',
  'message 2',
];
adapter.publishBatch('my_channel', messages);
```

## Examples

The library comes with [examples](examples) for the adapter and a [Dockerfile](Dockerfile) for
running the example scripts.

Run `make up`.

You will start at a `bash` prompt in the `/usr/src/app` directory.

If you need another shell to publish a message to a blocking consumer, you can run `docker-compose run js-pubsub-redis /bin/bash`

To run the examples:
```bash
$ node examples/RedisConsumerExample.js
$ node examples/RedisPublishExample.js (in a separate shell)
```

---
_Source: https://npm.io/package/@superbalist/js-pubsub-redis · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
