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

Commit 8d6f5b8

Browse files
jacobheunachingbrainAlan Shaw
authored
post: release of js-libp2p 0.27 (#357)
* Create 081-js-libp2p-0.27.md * Apply suggestions from code review Co-Authored-By: Alex Potsides <[email protected]> * Apply suggestions from code review Co-Authored-By: Alan Shaw <[email protected]> * blog: add intro to js-libp2p refactor and update date * chore: apply suggestions from code review Co-Authored-By: Alan Shaw <[email protected]> Co-authored-by: Alex Potsides <[email protected]> Co-authored-by: Alan Shaw <[email protected]>
1 parent 7633858 commit 8d6f5b8

File tree

1 file changed

+170
-0
lines changed

1 file changed

+170
-0
lines changed

content/post/081-js-libp2p-0.27.md

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
---
2+
date: 2020-02-07
3+
url: 2020-02-07-js-libp2p-0-27
4+
title: js-libp2p 0.27 released
5+
author: Jacob Heun
6+
---
7+
8+
It's heeeeere! After a very long road, and a lot of [lessons learned](/2020-02-06-big-refactors/), the Async Await refactor of js-libp2p has landed in the **0.27** release. If you're not familiar with the refactor you can read up more about the reasons and history in a recent blog post by the wondeful Alan Shaw, [The Async Await Refactor](/2020-02-01-async-await-refactor/). In addition to the efforts mentioned there, the refactor to js-libp2p includes a slew of additional improvements, the highlights of which you can read about below.
9+
10+
In addition to these highlights, we've consolidated many of the core modules of js-libp2p into js-libp2p itself in an effort to make it easier for community members to contribute. We've also consolidated our interface repositories into [libp2p/js-interfaces](https://github.com/libp2p/js-interfaces) and improved the documentation and test suites there.
11+
12+
And a wonderful bonus, we've measured memory usage improvements between **30-40%** compared to the previous version, 0.26!
13+
14+
We're really excited for 2020 and the opportunities this HUGE effort has opened for js-libp2p, and we're looking forward to making it even better!
15+
16+
# 🔦 Highlights
17+
18+
## 📜 Improved docs
19+
20+
We've done an overhaul of our docs to make libp2p easier to use. Among other docs in the new [doc][docs] folder, you can find a full list of exposed methods in the [API.md][api], and a guide on how to configure libp2p in [CONFIGURATION.md][config]. We've also created a [Getting Started guide][getting_started] for anyone starting out with libp2p.
21+
22+
## ⌚️ Async/Await instead of Callbacks
23+
24+
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.
25+
26+
## 🚰 Streaming Iterables instead of Pull Streams
27+
28+
Now that readable streams are async iterable, we can leverage [Streaming Iterables][streaming_iterables] instead of Pull Streams to greatly simplify the internal stream logic of libp2p. Among other things, this makes debugging streams much easier. You can check out the [it-awesome repo](https://github.com/alanshaw/it-awesome) for a list of an increasing number of modules built for the streaming iterables ecosystem. This also includes modules to convert to and from pull streams if you need to refactor your applications over time. If you're having trouble migrating, please feel free to reach out on the [discuss forums][discuss]!
29+
30+
## 📞 Clearer Connections
31+
32+
We've created a whole new [Connection Interface][connection]! Creating multiple streams off of a single connection is now much clearer, and every stream created is tracked in the Connection. This makes it much easier to keep track of every open stream, which greatly empowers resource management in js-libp2p.
33+
34+
```js
35+
// Was
36+
libp2p.dialProtocol(remotePeerInfo, protocol, (error, stream) => { })
37+
38+
// Now
39+
const connection = await libp2p.dial(remotePeerInfo)
40+
const { stream, protocol } = await connection.newStream(protocols)
41+
const allStreams = connection.streams
42+
```
43+
44+
## ⏹ Abortable Dials
45+
46+
We've reconstructed transports and connections from the ground up. This gives us the ability to pass an [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) when dialing, so we can now properly terminate connections early. This also means we'll be able to add proper support for parallel dials to reduce connection times without running the risk of lingering dials.
47+
48+
```js
49+
const controller = new AbortController()
50+
libp2p.dial(remotePeerInfo, { signal: controller.signal })
51+
// after a short delay...
52+
controller.abort()
53+
```
54+
55+
## 🆔 The Identify Push Protocol
56+
57+
[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.
58+
59+
## 🔍 Plaintext 2 for testing
60+
61+
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!
62+
63+
## 🙏 More polite connections
64+
65+
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.
66+
67+
```js
68+
libp2p.peerStore.on('change:protocols', ({ peerInfo, protocols }) => { ... })
69+
```
70+
71+
## 📊 Metrics (formerly Stats) can now be enabled/disabled
72+
73+
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].
74+
75+
# 🏗 API Changes
76+
77+
See the [API.md][api] readme for detailed usage on the new API. Significant breaking changes are detailed below.
78+
79+
* Callbacks are no longer supported, async / await is now used for all asynchronous methods. See [API.md][api] for a full list of methods.
80+
* Pull streams have been replaced by [Streaming Iterables][streaming_iterables]
81+
* `libp2p.peerBook` is now `libp2p.peerStore` to match common libp2p terminology.
82+
* `libp2p.stats` is now `libp2p.metrics`.
83+
* `libp2p.pubsub.ls` is now `libp2p.pubsub.getTopics`.
84+
* `libp2p.pubsub.peers` is now `libp2p.pubsub.getSubscribers`.
85+
* `libp2p.ping` now simply returns the latency of the ping. See the [migration guide][migration] for more details.
86+
87+
# ❤️ Huge thank you to everyone that made this release possible
88+
89+
In alphabetical order, here are the 60 humans that made 1241 contributions to this release:
90+
91+
* [AgentJ-WR](https://github.com/AgentJ-WR) (1 PR, 1 issue)
92+
* [Akulich Paul](https://github.com/pashoo2) (2 PRs, 1 issue, 2 reviews, 5 comments)
93+
* [Alan Shaw](https://github.com/alanshaw) (16 PRs, 1 issue, 31 reviews, 14 comments)
94+
* [Alex Potsides](https://github.com/achingbrain) (10 PRs, 6 issues, 7 reviews, 5 comments)
95+
* [Anton Nashatyrev](https://github.com/Nashatyrev) (1 issue, 1 comment)
96+
* [Arve Knudsen](https://github.com/aknuds1) (1 comment)
97+
* [Blake Byrnes](https://github.com/blakebyrnes) (1 issue, 1 comment)
98+
* [bruinxs](https://github.com/bruinxs) (1 PR, 1 issue, 1 comment)
99+
* [Carson Farmer](https://github.com/carsonfarmer) (3 PRs, 1 issue, 3 reviews, 17 comments)
100+
* [Cayman](https://github.com/wemeetagain) (2 PRs, 1 issue, 17 reviews, 7 comments)
101+
* [Chadwick Dahlquist](https://github.com/bugeats) (1 comment)
102+
* [Christian M](https://github.com/chriamue) (1 PR)
103+
* [Christian Paul](https://github.com/jaller94) (1 PR)
104+
* [David Dias](https://github.com/daviddias) (2 PRs, 4 issues, 21 reviews, 21 comments)
105+
* [Didrik Nordström](https://github.com/betamos) (1 PR, 1 comment)
106+
* [Dietrich Ayala](https://github.com/autonome) (1 comment)
107+
* [Dima](https://github.com/DieMyst) (1 issue)
108+
* [dirkmc](https://github.com/dirkmc) (5 PRs, 1 issue, 7 reviews, 2 comments)
109+
* [emclab](https://github.com/emclab) (1 issue, 1 comment)
110+
* [Eric Tu](https://github.com/ec2) (1 review)
111+
* [folex](https://github.com/folex) (1 comment)
112+
* [Friedel Ziegelmayer](https://github.com/dignifiedquire) (1 review, 1 comment)
113+
* [George Farcasiu](https://github.com/georgeaf99) (1 comment)
114+
* [Gopalakrishna Palem](https://github.com/KrishnaPG) (2 issues)
115+
* [Gregory Markou](https://github.com/GregTheGreek) (4 reviews, 3 comments)
116+
* [Guo Liu](https://github.com/guoliu) (1 issue, 1 comment)
117+
* [Henrique Dias](https://github.com/hacdias) (1 review, 2 comments)
118+
* [Hugo Dias](https://github.com/hugomrdias) (2 reviews)
119+
* [Jacob Heun](https://github.com/jacobheun) (59 PRs, 6 issues, 240 reviews, 80 comments)
120+
* [Jorropo](https://github.com/Jorropo) (1 PR)
121+
* [kumavis](https://github.com/kumavis) (1 PR, 1 issue, 1 review, 6 comments)
122+
* [Maciej Krüger](https://github.com/mkg20001) (2 PRs, 2 issues, 17 reviews, 30 comments)
123+
* [Marcin Rataj](https://github.com/lidel) (2 PRs, 13 reviews, 1 comment)
124+
* [Marcus Bernales](https://github.com/mboperator) (1 PR)
125+
* [Marin Petrunić](https://github.com/mpetrunic) (1 PR, 1 issue, 5 reviews, 3 comments)
126+
* [Maying(Matt) Shi](https://github.com/chinesebug) (1 issue)
127+
* [mcclure](https://github.com/mcclure) (2 issues, 3 comments)
128+
* [Mikeal Rogers](https://github.com/mikeal) (1 review)
129+
* [Nate Foss](https://github.com/npfoss) (2 PRs)
130+
* [Oli Evans](https://github.com/olizilla) (2 comments)
131+
* [phillmac](https://github.com/phillmac) (1 PR, 1 comment)
132+
* [Raúl Kripalani](https://github.com/raulk) (1 comment)
133+
* [ridenaio](https://github.com/ridenaio) (1 issue)
134+
* [Roman Proskuryakov](https://github.com/kpp) (1 comment)
135+
* [Rui Fortes](https://github.com/ruifortes) (2 issues)
136+
* [Ryan Bell](https://github.com/iRyanBell) (1 PR)
137+
* [shresthagrawal](https://github.com/shresthagrawal) (1 PR, 1 issue)
138+
* [Stavros Charitakis](https://github.com/sce9sc) (1 issue)
139+
* [swedneck](https://github.com/swedneck) (1 PR)
140+
* [Teri Chadbourne](https://github.com/terichadbourne) (1 comment)
141+
* [Tony Jin](https://github.com/nijynot) (1 PR, 1 issue, 2 comments)
142+
* [Topper Bowers](https://github.com/tobowers) (3 PRs, 2 issues, 13 comments)
143+
* [tuyennhv](https://github.com/tuyennhv) (1 review, 1 comment)
144+
* [Vasco Santos](https://github.com/vasco-santos) (91 PRs, 7 issues, 254 reviews, 79 comments)
145+
* [Yusef Napora](https://github.com/yusefnapora) (1 review)
146+
* [Ziwei_Wei](https://github.com/Ziwei-Wei) (1 comment)
147+
148+
# 🙌🏽 Want to contribute?
149+
150+
Would you like to contribute to the libp2p project and don't know how? Well, there are a few places you can get started:
151+
152+
- Check the issues with the `help wanted` label in the [libp2p repo](https://github.com/libp2p/js-libp2p/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)
153+
- Join an IPFS All Hands, introduce yourself and let us know where you would like to contribute - https://github.com/ipfs/team-mgmt#all-hands-call
154+
- Hack with IPFS and show us what you made! The All Hands call is also the perfect venue for demos, join in and show us what you built
155+
- Join the discussion at http://discuss.libp2p.io/ and help users finding their answers.
156+
- Join the [⚡️libp2p Weekly Sync 🙌🏽](https://github.com/libp2p/team-mgmt/issues/16) and be part of the Sprint action!
157+
158+
# ⁉️ Do you have questions?
159+
160+
The best place to ask your questions about libp2p, how it works and what you can do with it is at [discuss.libp2p.io](https://discuss.libp2p.io). We are also available at the #libp2p channel on Freenode.
161+
162+
[api]: https://github.com/libp2p/js-libp2p/blob/master/doc/API.md
163+
[config]: https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md
164+
[docs]: https://github.com/libp2p/js-libp2p/blob/master/doc/
165+
[getting_started]: https://github.com/libp2p/js-libp2p/blob/master/doc/GETTING_STARTED.md
166+
[metrics]: https://github.com/libp2p/js-libp2p/blob/master/doc/METRICS.md
167+
[migration]: https://github.com/libp2p/js-libp2p/blob/master/doc/migrations/v0.26-v0.27.md
168+
[streaming_iterables]: https://github.com/libp2p/js-libp2p/blob/master/doc/STREAMING_ITERABLES.md
169+
[discuss]: https://discuss.libp2p.io
170+
[connection]: https://github.com/libp2p/js-interfaces/tree/master/src/connection#interface-connection

0 commit comments

Comments
 (0)