You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: examples/circuit-relaying/README.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ This is what it looks like, in simplified steps:
39
39
40
40
That's it!
41
41
42
-
#### What's up with this `HOP` and `STOP` nonsense?
42
+
#### What's up with this `HOP` and `STOP`?
43
43
44
44
Circuit relay consists of two logical parts — dialer/listener and relay (`HOP`). The listener is also known as the `STOP` node. Each of these — dial, listen, and relay — happen on a different node. If we use the nodes from the above example, it looks something like this:
45
45
@@ -332,12 +332,12 @@ const ipfs = new IPFS({
332
332
- And finally we connected the two browser nodes using the `/p2p-circuit/ipfs/...` multiaddr. Take a look at the code below in [src/app.js](src/app.js#L102...L107) - lines 102-107
333
333
334
334
```js
335
-
ipfs.swarm.connect(peer, (err) => {
336
-
if (err) {
337
-
returnconsole.error(err)
338
-
}
339
-
$pAddrs.innerHTML+=`<li>${peer.trim()}</li>`
340
-
})
335
+
ipfs.swarm.connect(peer, (err) => {
336
+
if (err) {
337
+
returnconsole.error(err)
338
+
}
339
+
$pAddrs.innerHTML+=`<li>${peer.trim()}</li>`
340
+
})
341
341
```
342
342
343
343
The above code snippet handles connecting to other nodes using `ipfs.swarm.connect`. Notice how there wasn't anything special we had to do to use the circuit once we had everything connected; all the magic is in the multiaddr! [Multiaddrs](https://multiformats.io/multiaddr/) are **AWESOME**!
0 commit comments