diff --git a/src/index.js b/src/index.js index 27b386ab74..f13c4cfa38 100644 --- a/src/index.js +++ b/src/index.js @@ -146,10 +146,10 @@ class PubsubBaseProtocol extends EventEmitter { * @param {Object} props * @param {string} props.protocol * @param {DuplexStream} props.strean - * @param {PeerId} props.remotePeer remote peer-id + * @param {Connection} props.connection connection */ - async _onIncomingStream ({ protocol, stream, remotePeer }) { - const peerInfo = await PeerInfo.create(remotePeer) + async _onIncomingStream ({ protocol, stream, connection }) { + const peerInfo = await PeerInfo.create(connection.remotePeer) peerInfo.protocols.add(protocol) const idB58Str = peerInfo.id.toB58String() diff --git a/test/pubsub.spec.js b/test/pubsub.spec.js index 3a868848b0..f827eb6265 100644 --- a/test/pubsub.spec.js +++ b/test/pubsub.spec.js @@ -180,7 +180,9 @@ describe('pubsub base protocol', () => { await handlerB({ protocol, stream: c1.stream, - remotePeer: peerInfoA.id + connection: { + remotePeer: peerInfoA.id + } }) expect(pubsubA.peers.size).to.be.eql(1) @@ -200,7 +202,9 @@ describe('pubsub base protocol', () => { await handlerB({ protocol, stream: c1.stream, - remotePeer: peerInfoA.id + connection: { + remotePeer: peerInfoA.id + } }) // Notice peers of disconnect