Skip to content

Commit cfa0136

Browse files
chore: apply suggestions from code review
Co-Authored-By: Jacob Heun <[email protected]>
1 parent 4d9eabd commit cfa0136

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

API.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const libp2p = new Libp2p(options)
7272
Required keys in the `options` object:
7373

7474
- `peerInfo`: instance of [PeerInfo][] that contains the [PeerId][], Keys and [multiaddrs][multiaddr] of the libp2p Node.
75-
- `modules.transport`: An array that must include at least 1 transport, such as [`libp2p-tcp`](https://github.com/libp2p/js-libp2p-tcp).
75+
- `modules.transport`: An array that must include at least 1 compliant transport. See [modules that implement the transport interface](https://github.com/libp2p/js-interfaces/tree/master/src/transport#modules-that-implement-the-interface).
7676

7777
## Libp2p Instance Methods
7878

@@ -178,12 +178,12 @@ Dials to another peer in the network and selects a protocol to communicate with
178178

179179
```js
180180
// ...
181-
const conn = await libp2p.dialProtocol(remotePeerInfo, protocols)
181+
const { stream, protocol } = await libp2p.dialProtocol(remotePeerInfo, protocols)
182182
```
183183

184184
### hangUp
185185

186-
Closes an open connection with a peer, graciously.
186+
Attempts to gracefully close an open connection to the given peer. If the connection is not closed in the grace period, it will be forcefully closed.
187187

188188
`hangUp(peer)`
189189

@@ -208,7 +208,7 @@ await libp2p.hangUp(remotePeerInfo)
208208

209209
### handle
210210

211-
Registers a given handler for the given protocols.
211+
Sets up [multistream-select routing](https://github.com/multiformats/multistream-select) of protocols to their application handlers. Whenever a stream is opened on one of the provided protocols, the handler will be called. `handle` must be called in order to register a handler and support for a given protocol. This also informs other peers of the protocols you support.
212212

213213
`libp2p.handle(protocols, handler)`
214214

@@ -247,12 +247,12 @@ Unregisters all handlers with the given protocols
247247

248248
```js
249249
// ...
250-
libp2p.unhandle('/echo/1.0.0')
250+
libp2p.unhandle(['/echo/1.0.0'])
251251
```
252252

253253
### peerRouting.findPeer
254254

255-
Iterates over all peer routers in series to find the given peer.
255+
Iterates over all peer routers in series to find the given peer. If the DHT is enabled, it will be tried first.
256256

257257
`libp2p.peerRouting.findPeer(peerId, options)`
258258

@@ -280,7 +280,7 @@ const peerInfo = await libp2p.peerRouting.findPeer(peerId, options)
280280
### contentRouting.findProviders
281281

282282
Iterates over all content routers in series to find providers of the given key.
283-
Once a content router succeeds, the iteration will stop.
283+
Once a content router succeeds, the iteration will stop. If the DHT is enabled, it will be queried first.
284284

285285
`libp2p.contentRouting.findProviders(cid, options)`
286286

0 commit comments

Comments
 (0)