# orbit-db-pubsub

> Message propagation module for orbit-db

Latest version **0.7.0** (published 2023-01-17) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install orbit-db-pubsub
pnpm add orbit-db-pubsub
yarn add orbit-db-pubsub
bun add orbit-db-pubsub
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2023-01-17 |
| First published | 2016-09-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 13.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Haad |
| Maintainers | haad, shamb0t, hajamark |
| Keywords | orbitdb, orbit-db, pubsub |

## Links

- npm: https://www.npmjs.com/package/orbit-db-pubsub
- Homepage: https://github.com/orbitdb/orbit-db-pubsub
- Issues: https://github.com/orbitdb/orbit-db-pubsub/issues
- npm.io page: https://npm.io/package/orbit-db-pubsub

## Dependencies (3)

- [p-series](https://npm.io/package/p-series.md) ^1.1.0
- [logplease](https://npm.io/package/logplease.md) ~1.2.14
- [ipfs-pubsub-peer-monitor](https://npm.io/package/ipfs-pubsub-peer-monitor.md) ^0.1.0

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.7.0 (latest) — 2023-01-17
- 0.7.1-f56efb6.0 (next) — 2023-01-17
- 0.6.2-57b00a1.0 — 2023-01-17
- 0.6.2-b0abeb4.0 — 2023-01-08
- 0.6.2-ff64a3c.0 — 2022-08-27
- 0.6.1 — 2022-08-27
- 0.6.1-5d7f99e.0 — 2022-08-27
- 0.6.1-3ed04f8.0 — 2022-08-27
- 0.6.0 — 2020-09-06
- 0.5.7 — 2020-03-31
- 0.5.6 — 2020-01-08
- 0.5.5 — 2018-07-18
- 0.5.4 — 2018-07-18
- 0.5.3 — 2018-03-31
- 0.5.2 — 2018-03-31
- … 26 more at https://npm.io/package/orbit-db-pubsub/versions

## README

# orbit-db-pubsub

[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/orbitdb/Lobby) [![Matrix](https://img.shields.io/badge/matrix-%23orbitdb%3Apermaweb.io-blue.svg)](https://riot.permaweb.io/#/room/#orbitdb:permaweb.io) [![Discord](https://img.shields.io/discord/475789330380488707?color=blueviolet&label=discord)](https://discord.gg/cscuf5T)
[![npm version](https://badge.fury.io/js/orbit-db-pubsub.svg)](https://badge.fury.io/js/orbit-db-pubsub)

> Message propagation module for orbit-db

Default message propagation service for [orbit-db](https://github.com/orbitdb/orbit-db). Uses [IPFS](https://dist.ipfs.io/go-ipfs/floodsub-2) [pubsub](https://github.com/ipfs/go-ipfs/blob/master/core/commands/pubsub.go#L23).

# Install

This project uses [npm](http://npmjs.com/) and [nodejs](https://nodejs.org/).

```sh
npm install orbit-db-pubsub
```

## Usage

### API

#### subscribe(topic, onMessageHandler, onNewPeerHandler)

Listen for new messages in `topic`

`onMessageHandler` gets called when a message is received with signature `(topic, data)`

`onNewPeerHandler` gets called when a new peer joins with signature `(topic, peer)`

Returns a promise.

#### unsubscribe(topic)

Stop listening for new messages in `topic`

Returns a promise.

#### disconnect ()

Stop listening for new messages in all topics

Returns a promise.

#### publish(topic, data)

Publish `data` to a `topic`

## Contributing

If you think this could be better, please [open an issue](https://github.com/orbitdb/orbit-db-pubsub/issues/new)!

Please note that all interactions in [@orbitdb](https://github.com/orbitdb) fall under our [Code of Conduct](CODE_OF_CONDUCT.md).

## License

[MIT](LICENSE) ©️ 2016-2018 Protocol Labs Inc., Haja Networks Oy

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