-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(docs): update webrtc instructions for node in faq #3183
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,12 +71,10 @@ To add WebRTC support in a IPFS node instance, do: | |
|
||
```JavaScript | ||
const wrtc = require('wrtc') // or require('electron-webrtc')() | ||
const WStar = require('libp2p-webrtc-star') | ||
const wstar = new WStar({ wrtc }) | ||
const WebRTCStar = require('libp2p-webrtc-star') | ||
|
||
const node = await IPFS.create({ | ||
repo: 'your-repo-path', | ||
// start: false, | ||
config: { | ||
Addresses: { | ||
Swarm: [ | ||
|
@@ -88,8 +86,19 @@ const node = await IPFS.create({ | |
}, | ||
libp2p: { | ||
modules: { | ||
transport: [wstar], | ||
peerDiscovery: [wstar.discovery] | ||
transport: [WebRTCStar] | ||
}, | ||
config: { | ||
peerDiscovery: { | ||
[WebRTCStar.tag]: { | ||
enabled: true | ||
} | ||
}, | ||
transport: { | ||
WebRTCStar: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be really nice if libp2p could make these keys case-insensitive or throw when an unknown key is encountered - There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will work on improving the config per libp2p/js-libp2p#576. It will probably change a lot the way we config libp2p. But referencing so that we have this in attention There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just noticed in our config docs that we have this: const transportKey = WebRTCStar.prototype[Symbol.toStringTag] Should we use it here to avoid confusions on where the naming comes from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I'm not sure if that makes it any clearer. It would be vastly preferable to be able to just use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should rething that in the config issue for libp2p. From what I know, the |
||
wrtc | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to remove discovery?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the old instructions you have to
new
up a WebRTCStar instance to get the discovery property, but now that throws an error about providing an upgrader.Could you make a suggested change to correct the config here please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/libp2p/js-libp2p/blob/v0.27.8/doc/CONFIGURATION.md#setup-webrtc-transport-and-discovery
FYI I also did #3092 a while ago that uses the tag's instead of the string to avoid errors like the case sensitive that you mentioned earlier, but this is only available for discovery.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also PRd libp2p to use the tag in this missing doc: libp2p/js-libp2p#713
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is #3092 ready for review/merging? It's been draft for ages.