Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

update readme to show how to replicate feed #22

Closed
ZhouHansen opened this issue May 14, 2019 · 3 comments
Closed

update readme to show how to replicate feed #22

ZhouHansen opened this issue May 14, 2019 · 3 comments

Comments

@ZhouHansen
Copy link
Contributor

How to replicate hypercore, like discovery-swarm

feed.ready(function () {
  // we use the discovery as the topic
  swarm.join(feed.discoveryKey)
  swarm.on('connection', function (connection) {
    console.log('(New peer connected!)')

    // We use the pump module instead of stream.pipe(otherStream)
    // as it does stream error handling, so we do not have to do that
    // manually.

    // See below for more detail on how this work.
    pump(connection, feed.replicate({ live: true }), connection)
  })
})
@ZhouHansen
Copy link
Contributor Author

ZhouHansen commented May 14, 2019

According to #7

// {live: true} keep the replication stream open
var sw = discovery(feed, {live: true})

Hope the readme can be updated

@ZhouHansen ZhouHansen changed the title update readme to replicate feed update readme to show how to replicate feed May 14, 2019
@RangerMauve
Copy link
Contributor

RangerMauve commented May 16, 2019

Feel free to submit a PR with the sort of code you'd like to see in the README. :)

@ZhouHansen
Copy link
Contributor Author

After I red the source code, I found pass {live: true} makes no sense.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants