Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.

Commit 7119b0c

Browse files
jacobheunAlan Shaw
and
Alan Shaw
authored
Apply suggestions from code review
Co-Authored-By: Alan Shaw <[email protected]>
1 parent e3af25f commit 7119b0c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

β€Žcontent/post/081-js-libp2p-0.27.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ We've done an overhaul of our docs to make libp2p easier to use. Among other doc
1515

1616
## ⌚️ Async/Await instead of Callbacks
1717

18-
All callback APIs have been change to be async / await compliant. See the [API.md][api] readme for detailed usage. When migrating, you can leverage the [migration guide][migration] to see samples on some of the common migrations you may need to make.
18+
All callback APIs have been changed to be async / await compliant. See the [API.md][api] readme for detailed usage. When migrating, you can leverage the [migration guide][migration] to see samples on some of the common migrations you may need to make.
1919

2020
## 🚰 Streaming Iterables instead of Pull Streams
2121

@@ -31,7 +31,7 @@ libp2p.dialProtocol(remotePeerInfo, protocol, (error, stream) => { })
3131

3232
// Now
3333
const connection = await libp2p.dial(remotePeerInfo)
34-
const { stream, protocol } = connection.newStream(protocols)
34+
const { stream, protocol } = await connection.newStream(protocols)
3535
const allStreams = connections.streams
3636
```
3737

@@ -50,19 +50,19 @@ controller.abort()
5050

5151
[Identify Push](https://github.com/libp2p/specs/tree/master/identify#identifypush) is now available in js-libp2p. As a libp2p node changes its Multiaddrs (changes in networks) or protocols, it will broadcast those changes to all connected peers. Once support for AutoNAT and AutoRelay is added to js-libp2p, we will be able to broadcast those changes maximizing the effectiveness of those protocols.
5252

53-
## :mag: Plaintext 2 for testing
53+
## πŸ” Plaintext 2 for testing
5454

5555
We've upgraded from [Plaintext 1 to 2](https://github.com/libp2p/specs/tree/master/plaintext#protocol-id-and-version-history). If you need to test things locally without encryption to see what's going on over the wire, Plaintext 2 makes this more viable. Public Keys are now exchanged, which is required by many protocols. This should NEVER be used in production, happy testing!
5656

57-
## :pray: More polite connections
57+
## πŸ™ More polite connections
5858

5959
Currently when two nodes connect, they will actively ask each other what protocols they support. This ends up being multiple checks in parallel, rather than getting the information from a single Identify check. js-libp2p will now only use Identify. This greatly reduces network chatter. The `peerStore`, formerly `peerBook` to better match common libp2p terminology, will now emit change events for protocols. Applications that need to check for protocol support can now politely listen for updates, instead of actively checking every peer that connects.
6060

6161
```js
6262
libp2p.peerStore.on('change:protocols', ({ peerInfo, protocols }) => { ... })
6363
```
6464

65-
## πŸ“ŠStats (now Metrics) can now be enabled/disabled
65+
## πŸ“Š Metrics (formerly Stats) can now be enabled/disabled
6666

6767
We're making `stats` disabled by default and they are now available at `libp2p.metrics` instead of `libp2p.stats`. You can enable metrics if you need them, but for performance reasons we have disabled them by default. Good news, if you need to run them they're more performant as we've moved away from event emitting in metrics. This greatly reduces the amount of processing that happens until you explicitly request something! You can read more about Metrics at [METRICS.md][metrics].
6868

0 commit comments

Comments
Β (0)