# comet-redis

> lightweight redis client to communicate between components

Latest version **2.0.3** (published 2017-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install comet-redis
pnpm add comet-redis
yarn add comet-redis
bun add comet-redis
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2017-03-23 |
| First published | 2017-03-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Florentin DUBOIS |
| Maintainers | florentindubois |

## Links

- npm: https://www.npmjs.com/package/comet-redis
- Repository: https://github.com/starry-comet/comet-redis
- Homepage: https://github.com/starry-comet/comet-redis#readme
- Issues: https://github.com/starry-comet/comet-redis/issues
- npm.io page: https://npm.io/package/comet-redis

## Dependencies (4)

- [rxjs](https://npm.io/package/rxjs.md) ^5.2.0
- [ioredis](https://npm.io/package/ioredis.md) ^2.5.0
- [comet-ioc](https://npm.io/package/comet-ioc.md) ^2.0.2
- [@types/ioredis](https://npm.io/package/@types/ioredis.md) ^0.0.22

## Recent versions

- 2.0.3 (latest) — 2017-03-23
- 2.0.2 — 2017-03-20
- 2.0.1 — 2017-03-20
- 2.0.0 — 2017-03-20
- 1.0.1 — 2017-03-19
- 1.0.0 — 2017-03-18

## README

comet-redis
======

[![NSP Status](https://nodesecurity.io/orgs/starry-comet/projects/8f393709-8b9a-4187-8b55-38221d333368/badge)](https://nodesecurity.io/orgs/starry-comet/projects/8f393709-8b9a-4187-8b55-38221d333368)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0221f05bb77c4502b3c7816327f433f4)](https://www.codacy.com/app/miton18/comet-redis?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=starry-comet/comet-redis&amp;utm_campaign=Badge_Grade)

<p align="center">
  <img height="200" src="https://github.com/starry-comet/comet/blob/master/resources/images/comet.png?raw=true">
</p>

## Roles

This project has to main to give a lightweight redis client that allow to you to easily subscribe and publish between components.

## Usage

To use comet-redis, see the example below:

```ts
import {injectable, inject} from 'comet-ioc'
import {RedisPublisher, RedisSubscriber} from 'comet-redis'

@injectable()
export class MainClass {
  public constructor(
    @inject(RedisPublisher) $publisher: RedisPublisher
    @inject(RedisSubscriber) $subscriber: RedisSubscriber
  ) {
    $subscriber.subscribe<string>('channel', {
      next(message: string): void {
        console.log(message)
      },

      error(error: Error): void {},
      complete(): void {}
    })

    setTimeout(() => {
      $publisher.publish('channel', 'hi !')
    }, 1000)
  }
}
```

```ts
import {bootstrap, interfaces} from 'comet-ioc'
import {RedisModule, RedisToken, RedisFactory, Redis} from 'comet-redis'

import {MainClass} from './a/file'

bootstrap(MainClass, {
  imports: [RedisModule],
  providers: [{
    provide: RedisToken,
    useFactory(context: interfaces.Context): Redis {
      return RedisFactory('redis://127.0.0.1:6379')
    }
  }]
})
```

result:
```
hi !
```

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