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 Jan 12, 2024. It is now read-only.
refactor: return peer IDs as strings not CIDs (#2729)
Also updates all examples to use the new API.
Depends on:
- [x] ipfs-inactive/interface-js-ipfs-core#581
- [x] ipfs-inactive/js-ipfs-http-client#1226
- [x] libp2p/js-libp2p#545
BREAKING CHANGE:
Where `PeerID`s were previously [CID](https://www.npmjs.com/package/cids)s, now they are Strings
- `ipfs.bitswap.stat().peers[n]` is now a String (was a CID)
- `ipfs.dht.findPeer().id` is now a String (was a CID)
- `ipfs.dht.findProvs()[n].id` is now a String (was a CID)
- `ipfs.dht.provide()[n].id` is now a String (was a CID)
- `ipfs.dht.put()[n].id` is now a String (was a CID)
- `ipfs.dht.query()[n].id` is now a String (was a CID)
- `ipfs.id().id` is now a String (was a CID)
- `ipfs.id().addresses[n]` are now [Multiaddr](https://www.npmjs.com/package/multiaddr)s (were Strings)
Copy file name to clipboardexpand all lines: exchange-files-in-browser/README.md
+26-7
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
This tutorial will help you exchange files between browser nodes and go-ipfs or js-ipfs nodes!
4
4
5
-
**Note:** As `js-ipfs@0.33.x` 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.
5
+
**Note:** As `js-ipfs@0.41.x` 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.
6
6
7
7
That being said, we will explain how to circumvent these caveats and once they are fixed, we'll update the tutorial as well.
8
8
@@ -35,9 +35,10 @@ Here's what we are going to be doing:
35
35
36
36
1. Install a `go-ipfs` or `js-ipfs` node in your machine
37
37
2. Make your daemons listen on WebSockets
38
-
3. Start the app
39
-
4. Dial to a node using WebSockets (your desktop ones)
40
-
5. Transfer files between all of your nodes!
38
+
3. Start a `libp2p-webrtc-star` signaling server
39
+
4. Start the app
40
+
5. Dial to a node using WebSockets (your desktop ones)
41
+
6. Transfer files between all of your nodes!
41
42
42
43
Just follow the instructions below and it will be up and running in no time!
43
44
@@ -121,7 +122,25 @@ Daemon is ready
121
122
122
123
Check the `/ws` in line 5, that means it is listening. Cool.
123
124
124
-
### 3. Start the app
125
+
### 3. Start a `libp2p-webrtc-star` signaling server
126
+
127
+
This server allows the two browser nodes to talk to each other by doing the initial handshake and network introductions.
128
+
129
+
First install the `libp2p-webrtc-star` module globally:
130
+
131
+
```sh
132
+
> npm install -g libp2p-webrtc-star
133
+
```
134
+
135
+
This will give you the `webrtc-star` command. Use this to start a signaling server:
136
+
137
+
```sh
138
+
> webrtc-star
139
+
```
140
+
141
+
By default it will listen to all incoming connections on port 13579. Override this with the `--host` and/or `--port` options.
142
+
143
+
### 4. Start the app
125
144
126
145
Make sure you're in `js-ipfs/examples/exchange-files-in-browser`.
127
146
@@ -147,7 +166,7 @@ Hit CTRL-C to stop the server
147
166
148
167
Now go to http://127.0.0.1:12345 in a modern browser and you're on!
149
168
150
-
### 4. Dial to a node using WebSockets (your desktop ones)
169
+
### 5. Dial to a node using WebSockets (your desktop ones)
151
170
152
171
Make sure you have a daemon running. If you don't, run:
0 commit comments