Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Replace spdy with multiplex + echo example changes #55

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions examples/echo/dialer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ async.parallel([

const peerListener = new PeerInfo(ids[1])
idListener = ids[1]
peerListener.multiaddr.add(multiaddr('/ip4/127.0.0.1/tcp/10333'))

let toDial = '/ip4/127.0.0.1/tcp/10333'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is missing here, it should have the /ipfs/Qmhash

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a leftover from how it was before. Example seems to work anyways. You want me to add it though, since the ID in our echo example is always the same anyways?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try both

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??? Tried without, and it's working


if (process.argv[2] !== undefined) {
toDial = process.argv[2]
}

peerListener.multiaddr.add(multiaddr(toDial))
nodeDialer.start((err) => {
if (err) {
throw err
Expand All @@ -55,12 +62,8 @@ async.parallel([
pull(
pull.values(['hey']),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

conn,
pull.through(console.log),
pull.collect((err, data) => {
if (err) {
throw err
}
console.log('received echo:', data.toString())
pull.drain((data) => {
console.log('got data: ' + data)
})
)
})
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
},
"dependencies": {
"libp2p": "^0.3.1",
"libp2p-multiplex": "^0.3.1",
"libp2p-mdns": "^0.5.2",
"libp2p-secio": "^0.6.5",
"libp2p-spdy": "^0.10.3",
Expand All @@ -66,4 +67,4 @@
"greenkeeperio-bot <support@greenkeeper.io>",
"varunagarwal315 <varunagarwal315@gmail.com>"
]
}
}
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const TCP = require('libp2p-tcp')
const WebRTCStar = require('libp2p-webrtc-star')
const MulticastDNS = require('libp2p-mdns')
const WS = require('libp2p-websockets')
const spdy = require('libp2p-spdy')
// TODO remove if not needed
// const spdy = require('libp2p-spdy')
const multiplex = require('libp2p-multiplex')
const secio = require('libp2p-secio')
const libp2p = require('libp2p')

Expand All @@ -22,7 +24,7 @@ class Node extends libp2p {
],
connection: {
muxer: [
spdy
multiplex
],
crypto: [
secio
Expand Down