Add documentation about starting IPFS with pubsub enabled

This commit is contained in:
haad 2017-11-29 07:24:33 +01:00
parent f13c52eaae
commit 38da14db72
2 changed files with 26 additions and 2 deletions

View File

@ -46,8 +46,21 @@ Require OrbitDB and IPFS in your program and create the instances:
const IPFS = require('ipfs')
const OrbitDB = require('orbit-db')
const ipfs = new IPFS()
// OrbitDB uses Pubsub which is an experimental feature
// and need to be turned on manually.
// Note that these options need to be passed to IPFS in
// all examples in this document even if not specfied so.
const ipfsOptions = {
EXPERIMENTAL: {
pubsub: true
},
}
// Create IPFS instance
const ipfs = new IPFS(ipfsOptions)
ipfs.on('ready', () => {
// Create OrbitDB instance
const orbitdb = new OrbitDB(ipfs)
})
```

View File

@ -65,7 +65,18 @@ Use it as a module:
const IPFS = require('ipfs')
const OrbitDB = require('orbit-db')
const ipfs = new IPFS()
// OrbitDB uses Pubsub which is an experimental feature
// and need to be turned on manually.
// Note that these options need to be passed to IPFS in
// all examples even if not specfied so.
const ipfsOptions = {
EXPERIMENTAL: {
pubsub: true
},
}
// Create IPFS instance
const ipfs = new IPFS(ipfsOptions)
ipfs.on('error', (e) => console.error(e))
ipfs.on('ready', async () => {