Skip to content

Commit

Permalink
chore: update pubsub implementations (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored and jacobheun committed Dec 12, 2019
1 parent 11ed6bd commit dbb9e57
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
"libp2p-bootstrap": "^0.10.3",
"libp2p-delegated-content-routing": "^0.4.1",
"libp2p-delegated-peer-routing": "^0.4.0",
"libp2p-floodsub": "^0.19.0",
"libp2p-gossipsub": "^0.1.0",
"libp2p-floodsub": "^0.20.0",
"libp2p-gossipsub": "^0.2.0",
"libp2p-kad-dht": "^0.18.0",
"libp2p-mdns": "^0.13.0",
"libp2p-mplex": "^0.9.1",
Expand Down
4 changes: 2 additions & 2 deletions src/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ module.exports = (node, Pubsub, config) => {
* @param {string} topic
* @returns {Array<string>}
*/
getPeersSubscribed: (topic) => {
getSubscribers: (topic) => {
if (!node.isStarted() && !pubsub.started) {
throw errCode(new Error(messages.NOT_STARTED_YET), codes.PUBSUB_NOT_STARTED)
}

return pubsub.getPeersSubscribed(topic)
return pubsub.getSubscribers(topic)
},

setMaxListeners (n) {
Expand Down
2 changes: 1 addition & 1 deletion test/pubsub/implementations.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('Pubsub subsystem is able to use different implementations', () => {

// wait for remoteLibp2p to know about libp2p subscription
await pWaitFor(() => {
const subscribedPeers = remoteLibp2p.pubsub.getPeersSubscribed(topic)
const subscribedPeers = remoteLibp2p.pubsub.getSubscribers(topic)
return subscribedPeers.includes(libp2pId)
})

Expand Down
4 changes: 2 additions & 2 deletions test/pubsub/operation.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('Pubsub subsystem operates correctly', () => {

// wait for remoteLibp2p to know about libp2p subscription
await pWaitFor(() => {
const subscribedPeers = remoteLibp2p.pubsub.getPeersSubscribed(topic)
const subscribedPeers = remoteLibp2p.pubsub.getSubscribers(topic)
return subscribedPeers.includes(libp2pId)
})
remoteLibp2p.pubsub.publish(topic, data)
Expand Down Expand Up @@ -172,7 +172,7 @@ describe('Pubsub subsystem operates correctly', () => {

// wait for remoteLibp2p to know about libp2p subscription
await pWaitFor(() => {
const subscribedPeers = remoteLibp2p.pubsub.getPeersSubscribed(topic)
const subscribedPeers = remoteLibp2p.pubsub.getSubscribers(topic)
return subscribedPeers.includes(libp2pId)
})

Expand Down

0 comments on commit dbb9e57

Please sign in to comment.