Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 07228a0

Browse files
committed
docs(examples): exchange files in the browser
1 parent 877cab7 commit 07228a0

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

examples/exchange-files-in-browser/README.md

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
> Welcome! This tutorial will help you exchange files between browser nodes and go-ipfs nodes.
44
5-
There are a couple of caveats:
6-
7-
- js-ipfs currently doesn't support DHT peer discovery, the peer from which you are fetching data should be within the reach (local or in public IP) of the browser node.
8-
- We need to use a signalling server to establish the WebRTC connections, this won't be necessary as soon as libp2p-relay gets developed
5+
caveat: js-ipfs currently doesn't support DHT peer discovery, the peer from which you are fetching data should be within the reach (local or in public IP) of the browser node.
96

107
That being said, we will explain throughout this tutorial to circunvent the caveats and once they are fixed, we will update the tutorial as well.
118

@@ -14,18 +11,16 @@ That being said, we will explain throughout this tutorial to circunvent the cave
1411
The goal of this tutorial is to create a application with a IPFS node that dials to other instances of it using WebRTC, and at the same time dial and transfer files from a Desktop IPFS node using WebSockets as the transport.
1512

1613
```
17-
┌──────────────┐ ┌──────────────┐
18-
│ Browser │ │ Browser │
19-
│ │ WebRTC │ │
20-
│ │◀─────────────────▶│ │
21-
└──────────────┘ └──────────────┘
22-
▲ ▲
23-
│ │
24-
│WebSockets WebSockets│
25-
│ ┌──────────────┐ │
26-
│ │ Desktop │ │
27-
└───────▶│ │◀─────────┘
28-
└──────────────┘
14+
┌──────────────┐ ┌──────────────┐
15+
│ Browser │ libp2p(WebRTC) │ Browser │
16+
│ │◀──────────────▶│ │
17+
└──────────────┘ └──────────────┘
18+
▲ ▲
19+
│WebSockets WebSockets│
20+
│ ┌──────────────┐ │
21+
│ │ Desktop │ │
22+
└───────▶│ Terminal │◀─────────┘
23+
└──────────────┘
2924
```
3025

3126
## Check out the final state
@@ -83,26 +78,26 @@ Note: js-ipfs sets up a websocket listener by default, if you are just using js-
8378
Since websockets support is currently not on by default, you'll need to add a WebSockets address manually. Look into your config file and find the `Addresses` section:
8479

8580
```json
86-
"Addresses": {
87-
"Swarm": [
88-
"/ip4/0.0.0.0/tcp/4002"
89-
],
90-
"API": "/ip4/127.0.0.1/tcp/5002",
91-
"Gateway": "/ip4/127.0.0.1/tcp/9090"
92-
}
81+
"Addresses": {
82+
"Swarm": [
83+
"/ip4/0.0.0.0/tcp/4002"
84+
],
85+
"API": "/ip4/127.0.0.1/tcp/5002",
86+
"Gateway": "/ip4/127.0.0.1/tcp/9090"
87+
}
9388
```
9489

9590
Add the following entry to your `Swarm` array: `/ip4/127.0.0.1/tcp/9999/ws`. Now, it should look like this:
9691

9792
```json
98-
"Addresses": {
99-
"Swarm": [
100-
"/ip4/0.0.0.0/tcp/4002",
101-
"/ip4/127.0.0.1/tcp/9999/ws"
102-
],
103-
"API": "/ip4/127.0.0.1/tcp/5002",
104-
"Gateway": "/ip4/127.0.0.1/tcp/9090"
105-
}
93+
"Addresses": {
94+
"Swarm": [
95+
"/ip4/0.0.0.0/tcp/4002",
96+
"/ip4/127.0.0.1/tcp/9999/ws"
97+
],
98+
"API": "/ip4/127.0.0.1/tcp/5002",
99+
"Gateway": "/ip4/127.0.0.1/tcp/9090"
100+
}
106101
```
107102

108103
Now it should listen on Websockets. We're ready to start the daemon.

0 commit comments

Comments
 (0)