mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-28 00:11:34 +00:00
identify + test refactor and reorg
This commit is contained in:
@ -1,7 +1,20 @@
|
||||
var swarm = require('./../src').singleton
|
||||
var Identify = require('./../src/identify')
|
||||
var Swarm = require('./../src')
|
||||
var Peer = require('ipfs-peer')
|
||||
var Id = require('ipfs-peer-id')
|
||||
var multiaddr = require('multiaddr')
|
||||
|
||||
swarm.listen()
|
||||
var b = new Swarm()
|
||||
b.port = 4001
|
||||
var peerB = new Peer(Id.create(), [multiaddr('/ip4/127.0.0.1/tcp/' + b.port)])
|
||||
|
||||
swarm.registerHandle('/ipfs/sparkles/1.2.3', function (stream) {
|
||||
var i = new Identify(b, peerB)
|
||||
i.on('thenews', function (news) {
|
||||
console.log('such news')
|
||||
})
|
||||
|
||||
b.listen()
|
||||
|
||||
b.registerHandle('/ipfs/sparkles/1.2.3', function (stream) {
|
||||
console.log('woop got a stream')
|
||||
})
|
||||
|
Reference in New Issue
Block a user