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/exchange-files-in-browser/README.md
+26-31Lines changed: 26 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,7 @@
2
2
3
3
> Welcome! This tutorial will help you exchange files between browser nodes and go-ipfs nodes.
4
4
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.
9
6
10
7
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.
11
8
@@ -14,18 +11,16 @@ That being said, we will explain throughout this tutorial to circunvent the cave
14
11
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.
15
12
16
13
```
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
+
└──────────────┘
29
24
```
30
25
31
26
## 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-
83
78
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:
84
79
85
80
```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
+
}
93
88
```
94
89
95
90
Add the following entry to your `Swarm` array: `/ip4/127.0.0.1/tcp/9999/ws`. Now, it should look like this:
96
91
97
92
```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
+
}
106
101
```
107
102
108
103
Now it should listen on Websockets. We're ready to start the daemon.
0 commit comments