From 59df82a675bf2da29f0368002f964bb6d87a1839 Mon Sep 17 00:00:00 2001 From: David Dias Date: Wed, 7 Feb 2018 07:48:50 +0000 Subject: [PATCH] docs: dialProtocol --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37cef0cf..a411d9ba 100644 --- a/README.md +++ b/README.md @@ -158,9 +158,18 @@ class Node extends libp2p { `callback` is a function with the following `function (err) {}` signature, where `err` is an Error in case stopping the node fails. -#### `libp2p.dial(peer [, protocol, callback])` +#### `libp2p.dial(peer, callback)` -> Dials to another peer in the network. +> Dials to another peer in the network, establishes the connection. + +- `peer`: can be an instance of [PeerInfo][], [PeerId][], [multiaddr][], or a multiaddr string +- `callback`: Function with signature `function (err, conn) {}` where `conn` is a [Connection](https://github.com/libp2p/interface-connection) object + +`callback` is a function with the following `function (err, conn) {}` signature, where `err` is an Error in of failure to dial the connection and `conn` is a [Connection][] instance in case of a protocol selected, if not it is undefined. + +#### `libp2p.dialProtocol(peer, protocol, callback)` + +> Dials to another peer in the network and selects a protocol to talk with that peer. - `peer`: can be an instance of [PeerInfo][], [PeerId][], [multiaddr][], or a multiaddr string - `protocol`: String that defines the protocol (e.g '/ipfs/bitswap/1.1.0')