mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-07 14:46:37 +00:00
Add documentation about starting IPFS with pubsub enabled
This commit is contained in:
parent
f13c52eaae
commit
38da14db72
15
GUIDE.md
15
GUIDE.md
@ -46,8 +46,21 @@ Require OrbitDB and IPFS in your program and create the instances:
|
|||||||
const IPFS = require('ipfs')
|
const IPFS = require('ipfs')
|
||||||
const OrbitDB = require('orbit-db')
|
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', () => {
|
ipfs.on('ready', () => {
|
||||||
|
// Create OrbitDB instance
|
||||||
const orbitdb = new OrbitDB(ipfs)
|
const orbitdb = new OrbitDB(ipfs)
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
13
README.md
13
README.md
@ -65,7 +65,18 @@ Use it as a module:
|
|||||||
const IPFS = require('ipfs')
|
const IPFS = require('ipfs')
|
||||||
const OrbitDB = require('orbit-db')
|
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('error', (e) => console.error(e))
|
||||||
ipfs.on('ready', async () => {
|
ipfs.on('ready', async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user