# ssb-replicate

> :warning:

Latest version **1.3.5** (published 2023-12-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install ssb-replicate
pnpm add ssb-replicate
yarn add ssb-replicate
bun add ssb-replicate
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.5 |
| Published | 2023-12-06 |
| First published | 2019-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 42 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Dominic Tarr |
| Maintainers | powersource, arj03, staltz, mixmix, cel, dominictarr |

## Links

- npm: https://www.npmjs.com/package/ssb-replicate
- Repository: https://github.com/dominictarr/ssb-replicate
- Issues: https://github.com/dominictarr/ssb-replicate/issues
- npm.io page: https://npm.io/package/ssb-replicate

## Dependencies (9)

- [ssb-ref](https://npm.io/package/ssb-ref.md) ^2.16.0
- [pull-cat](https://npm.io/package/pull-cat.md) ^1.1.11
- [pull-next](https://npm.io/package/pull-next.md) ^1.0.1
- [deep-equal](https://npm.io/package/deep-equal.md) ^2.2.3
- [pull-notify](https://npm.io/package/pull-notify.md) ^0.1.2
- [pull-stream](https://npm.io/package/pull-stream.md) ^3.7.0
- [pull-paramap](https://npm.io/package/pull-paramap.md) ^1.2.2
- [pull-pushable](https://npm.io/package/pull-pushable.md) ^2.2.0
- [observ-debounce](https://npm.io/package/observ-debounce.md) ^1.1.1

## Recent versions

- 1.3.5 (latest) — 2023-12-06
- 1.3.4 — 2023-12-06
- 1.3.3 — 2021-04-26
- 1.3.2 — 2019-11-22
- 1.3.1 — 2019-11-13
- 1.3.0 — 2019-04-19
- 1.2.4 — 2019-04-18
- 1.2.3 — 2019-04-05
- 1.2.2 — 2019-04-05
- 1.2.1 — 2019-03-15
- 1.2.0 — 2019-03-15
- 1.1.0 — 2019-02-14
- 1.0.4 — 2019-01-15
- 1.0.3 — 2019-01-05
- 1.0.2 — 2019-01-05
- … 2 more at https://npm.io/package/ssb-replicate/versions

## README

# ssb-replicate

:warning:

**NOTE: This package has been deprecated in favor of [ssb-replication-scheduler](https://github.com/ssb-ngi-pointer/ssb-replication-scheduler)
We highly recommend not using ssb-replicate because its performance is significantly worse.**

:warning:

-------

ssb legacy replication. this was previously built into `ssb-server` (formerly known as `scuttlebot`)

## protocol

peers replicate by calling `createHistoryStream({id, seq})` for every feed to be replicate.
(if `replicate.request({id: <id>, replicate: true})` has been called - this is usually handled
by `ssb-friends`). (`id` is the replicated feed id, and seq is the latest sequence number a peer has)

see [the protocol guide](https://ssbc.github.io/scuttlebutt-protocol-guide/#createHistoryStream)

Since an ssb peer may replicate thousands of feeds, just making all these calls to `createHistoryStream`
can use quite a bit of bandwidth (and cpu on the receiving end) thus this module has been superceded
by [ssb-ebt](https://github.com/ssbc/ssb-ebt). but this is still included so for interop with other
old instances.

Also note, when a peer connects, at first only a single `createHistoryStream` is requested for the peer's
own feed - then it waits to see if the remote peer makes any `createHistoryStream` requests before
making more, this avoids hammering a peer not supporting legacy replication with thousands of requests.

## usage

```
var createSSB = require('ssb-server')
  .use(require('ssb-replicate'))

var sbot = createSSB({config...})
```

## config

```
{
  replicate: {
    legacy: boolean, // whether to support legacy replication.
                     // if set to false, another plugin must provide replication.
                     // (such as ssb-ebt)
    fallback: boolean, //if enabled, wait for another plugin to try to replicate first.
                       //if set will not start to replicate until replicate:fallback event is emitted on the rpc connection.
  }
}

```

## api

### replicate.request({id:feedId, replicate:replicate}) : sync

request that `feedId` be replicated (or not if `replicate` is false.
will begin or end replication on any currently open connections.

### replicate.changes : source

get a feed of replication progress.

### replicate.block : sync

call when `from` blocks `to`: block(from, to, isBlocking).

### replicate.upto : source

returns {} of feeds to replicate, with sequences.


## License

MIT

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