From 0062a4b5eba1a118719ab2824045d723733c26ea Mon Sep 17 00:00:00 2001 From: David Dias Date: Wed, 7 Feb 2018 08:28:36 +0000 Subject: [PATCH] docs: update examples --- examples/chat/src/dialer.js | 2 +- examples/echo/src/dialer.js | 2 +- examples/encrypted-communications/1.js | 2 +- examples/protocol-and-stream-muxing/1.js | 6 +++--- examples/protocol-and-stream-muxing/2.js | 6 +++--- examples/protocol-and-stream-muxing/README.md | 12 ++++++------ examples/transports/2.js | 2 +- examples/transports/3.js | 6 +++--- examples/transports/README.md | 8 ++++---- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/chat/src/dialer.js b/examples/chat/src/dialer.js index 25116b8a..9410f20d 100644 --- a/examples/chat/src/dialer.js +++ b/examples/chat/src/dialer.js @@ -47,7 +47,7 @@ async.parallel([ console.log(ma.toString() + '/ipfs/' + idListener.toB58String()) }) - nodeDialer.dial(peerListener, '/chat/1.0.0', (err, conn) => { + nodeDialer.dialProtocol(peerListener, '/chat/1.0.0', (err, conn) => { if (err) { throw err } diff --git a/examples/echo/src/dialer.js b/examples/echo/src/dialer.js index 82d61e19..b882511b 100644 --- a/examples/echo/src/dialer.js +++ b/examples/echo/src/dialer.js @@ -38,7 +38,7 @@ async.parallel([ '/ipfs/' + dialerId.toB58String())) console.log('Dialing to peer:', listenerMultiaddr.toString()) - dialerNode.dial(listenerPeerInfo, '/echo/1.0.0', (err, conn) => { + dialerNode.dialProtocol(listenerPeerInfo, '/echo/1.0.0', (err, conn) => { if (err) { throw err } console.log('nodeA dialed to nodeB on protocol: /echo/1.0.0') diff --git a/examples/encrypted-communications/1.js b/examples/encrypted-communications/1.js index 7d20b383..5342a96f 100644 --- a/examples/encrypted-communications/1.js +++ b/examples/encrypted-communications/1.js @@ -52,7 +52,7 @@ parallel([ ) }) - node1.dial(node2.peerInfo, '/a-protocol', (err, conn) => { + node1.dialProtocol(node2.peerInfo, '/a-protocol', (err, conn) => { if (err) { throw err } pull(pull.values(['This information is sent out encrypted to the other peer']), conn) }) diff --git a/examples/protocol-and-stream-muxing/1.js b/examples/protocol-and-stream-muxing/1.js index 1976ae54..59c050fa 100644 --- a/examples/protocol-and-stream-muxing/1.js +++ b/examples/protocol-and-stream-muxing/1.js @@ -75,20 +75,20 @@ parallel([ }) */ - node1.dial(node2.peerInfo, '/your-protocol', (err, conn) => { + node1.dialProtocol(node2.peerInfo, '/your-protocol', (err, conn) => { if (err) { throw err } pull(pull.values(['my own protocol, wow!']), conn) }) /* - node1.dial(node2.peerInfo, '/another-protocol/1.0.0', (err, conn) => { + node1.dialProtocol(node2.peerInfo, '/another-protocol/1.0.0', (err, conn) => { if (err) { throw err } pull(pull.values(['semver me please']), conn) }) */ /* - node1.dial(node2.peerInfo, '/custom-match-func/some-query', (err, conn) => { + node1.dialProtocol(node2.peerInfo, '/custom-match-func/some-query', (err, conn) => { if (err) { throw err } pull(pull.values(['do I fall into your criteria?']), conn) }) diff --git a/examples/protocol-and-stream-muxing/2.js b/examples/protocol-and-stream-muxing/2.js index 0dd42170..a8f2f632 100644 --- a/examples/protocol-and-stream-muxing/2.js +++ b/examples/protocol-and-stream-muxing/2.js @@ -60,17 +60,17 @@ parallel([ }) series([ - (cb) => node1.dial(node2.peerInfo, '/a', (err, conn) => { + (cb) => node1.dialProtocol(node2.peerInfo, '/a', (err, conn) => { if (err) { throw err } pull(pull.values(['protocol (a)']), conn) cb() }), - (cb) => node1.dial(node2.peerInfo, '/b', (err, conn) => { + (cb) => node1.dialProtocol(node2.peerInfo, '/b', (err, conn) => { if (err) { throw err } pull(pull.values(['protocol (b)']), conn) cb() }), - (cb) => node1.dial(node2.peerInfo, '/b', (err, conn) => { + (cb) => node1.dialProtocol(node2.peerInfo, '/b', (err, conn) => { if (err) { throw err } pull(pull.values(['another conn on protocol (b)']), conn) cb() diff --git a/examples/protocol-and-stream-muxing/README.md b/examples/protocol-and-stream-muxing/README.md index f8fb4e12..46486ef8 100644 --- a/examples/protocol-and-stream-muxing/README.md +++ b/examples/protocol-and-stream-muxing/README.md @@ -30,7 +30,7 @@ node2.handle('/your-protocol', (protocol, conn) => { After the protocol is _handled_, now we can dial to it. ```JavaScript -node1.dial(node2.peerInfo, '/your-protocol', (err, conn) => { +node1.dialProtocol(node2.peerInfo, '/your-protocol', (err, conn) => { if (err) { throw err } pull(pull.values(['my own protocol, wow!']), conn) }) @@ -47,7 +47,7 @@ node2.handle('/another-protocol/1.0.1', (protocol, conn) => { ) }) // ... -node1.dial(node2.peerInfo, '/another-protocol/1.0.0', (err, conn) => { +node1.dialProtocol(node2.peerInfo, '/another-protocol/1.0.0', (err, conn) => { if (err) { throw err } pull(pull.values(['semver me please']), conn) }) @@ -74,7 +74,7 @@ node2.handle('/custom-match-func', (protocol, conn) => { } }) // ... -node1.dial(node2.peerInfo, '/custom-match-func/some-query', (err, conn) => { +node1.dialProtocol(node2.peerInfo, '/custom-match-func/some-query', (err, conn) => { if (err) { throw err } pull(pull.values(['do I fall into your criteria?']), conn) }) @@ -129,17 +129,17 @@ node2.handle('/b', (protocol, conn) => { }) series([ - (cb) => node1.dial(node2.peerInfo, '/a', (err, conn) => { + (cb) => node1.dialProtocol(node2.peerInfo, '/a', (err, conn) => { if (err) { throw err } pull(pull.values(['protocol (a)']), conn) cb() }), - (cb) => node1.dial(node2.peerInfo, '/b', (err, conn) => { + (cb) => node1.dialProtocol(node2.peerInfo, '/b', (err, conn) => { if (err) { throw err } pull(pull.values(['protocol (b)']), conn) cb() }), - (cb) => node1.dial(node2.peerInfo, '/b', (err, conn) => { + (cb) => node1.dialProtocol(node2.peerInfo, '/b', (err, conn) => { if (err) { throw err } pull(pull.values(['another conn on protocol (b)']), conn) cb() diff --git a/examples/transports/2.js b/examples/transports/2.js index 17c0e0a6..5ebfc622 100644 --- a/examples/transports/2.js +++ b/examples/transports/2.js @@ -54,7 +54,7 @@ parallel([ ) }) - node1.dial(node2.peerInfo, '/print', (err, conn) => { + node1.dialProtocol(node2.peerInfo, '/print', (err, conn) => { if (err) { throw err } pull(pull.values(['Hello', ' ', 'p2p', ' ', 'world', '!']), conn) diff --git a/examples/transports/3.js b/examples/transports/3.js index 7f9817ce..5f96f9b8 100644 --- a/examples/transports/3.js +++ b/examples/transports/3.js @@ -66,19 +66,19 @@ parallel([ node2.handle('/print', print) node3.handle('/print', print) - node1.dial(node2.peerInfo, '/print', (err, conn) => { + node1.dialProtocol(node2.peerInfo, '/print', (err, conn) => { if (err) { throw err } pull(pull.values(['node 1 dialed to node 2 successfully']), conn) }) - node2.dial(node3.peerInfo, '/print', (err, conn) => { + node2.dialProtocol(node3.peerInfo, '/print', (err, conn) => { if (err) { throw err } pull(pull.values(['node 2 dialed to node 3 successfully']), conn) }) - node3.dial(node1.peerInfo, '/print', (err, conn) => { + node3.dialProtocol(node1.peerInfo, '/print', (err, conn) => { if (err) { console.log('node 3 failed to dial to node 1 with:', err.message) } diff --git a/examples/transports/README.md b/examples/transports/README.md index 52b40974..a1cf2256 100644 --- a/examples/transports/README.md +++ b/examples/transports/README.md @@ -143,7 +143,7 @@ parallel([ ) }) - node1.dial(node2.peerInfo, '/print', (err, conn) => { + node1.dialProtocol(node2.peerInfo, '/print', (err, conn) => { if (err) { throw err } pull(pull.values(['Hello', ' ', 'p2p', ' ', 'world', '!']), conn) @@ -240,21 +240,21 @@ parallel([ node3.handle('/print', print) // node 1 (TCP) dials to node 2 (TCP+WebSockets) - node1.dial(node2.peerInfo, '/print', (err, conn) => { + node1.dialProtocol(node2.peerInfo, '/print', (err, conn) => { if (err) { throw err } pull(pull.values(['node 1 dialed to node 2 successfully']), conn) }) // node 2 (TCP+WebSockets) dials to node 2 (WebSockets) - node2.dial(node3.peerInfo, '/print', (err, conn) => { + node2.dialProtocol(node3.peerInfo, '/print', (err, conn) => { if (err) { throw err } pull(pull.values(['node 2 dialed to node 3 successfully']), conn) }) // node 3 (WebSockets) attempts to dial to node 1 (TCP) - node3.dial(node1.peerInfo, '/print', (err, conn) => { + node3.dialProtocol(node1.peerInfo, '/print', (err, conn) => { if (err) { console.log('node 3 failed to dial to node 1 with:', err.message) }