mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-03-30 22:31:03 +00:00
chore: update pubsub implementations (#493)
This commit is contained in:
parent
8da9fc97d4
commit
9a6e07d70b
@ -94,8 +94,8 @@
|
|||||||
"libp2p-bootstrap": "^0.10.3",
|
"libp2p-bootstrap": "^0.10.3",
|
||||||
"libp2p-delegated-content-routing": "^0.4.1",
|
"libp2p-delegated-content-routing": "^0.4.1",
|
||||||
"libp2p-delegated-peer-routing": "^0.4.0",
|
"libp2p-delegated-peer-routing": "^0.4.0",
|
||||||
"libp2p-floodsub": "^0.19.0",
|
"libp2p-floodsub": "^0.20.0",
|
||||||
"libp2p-gossipsub": "^0.1.0",
|
"libp2p-gossipsub": "^0.2.0",
|
||||||
"libp2p-kad-dht": "^0.18.0",
|
"libp2p-kad-dht": "^0.18.0",
|
||||||
"libp2p-mdns": "^0.13.0",
|
"libp2p-mdns": "^0.13.0",
|
||||||
"libp2p-mplex": "^0.9.1",
|
"libp2p-mplex": "^0.9.1",
|
||||||
|
@ -83,12 +83,12 @@ module.exports = (node, Pubsub, config) => {
|
|||||||
* @param {string} topic
|
* @param {string} topic
|
||||||
* @returns {Array<string>}
|
* @returns {Array<string>}
|
||||||
*/
|
*/
|
||||||
getPeersSubscribed: (topic) => {
|
getSubscribers: (topic) => {
|
||||||
if (!node.isStarted() && !pubsub.started) {
|
if (!node.isStarted() && !pubsub.started) {
|
||||||
throw errCode(new Error(messages.NOT_STARTED_YET), codes.PUBSUB_NOT_STARTED)
|
throw errCode(new Error(messages.NOT_STARTED_YET), codes.PUBSUB_NOT_STARTED)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pubsub.getPeersSubscribed(topic)
|
return pubsub.getSubscribers(topic)
|
||||||
},
|
},
|
||||||
|
|
||||||
setMaxListeners (n) {
|
setMaxListeners (n) {
|
||||||
|
@ -85,7 +85,7 @@ describe('Pubsub subsystem is able to use different implementations', () => {
|
|||||||
|
|
||||||
// wait for remoteLibp2p to know about libp2p subscription
|
// wait for remoteLibp2p to know about libp2p subscription
|
||||||
await pWaitFor(() => {
|
await pWaitFor(() => {
|
||||||
const subscribedPeers = remoteLibp2p.pubsub.getPeersSubscribed(topic)
|
const subscribedPeers = remoteLibp2p.pubsub.getSubscribers(topic)
|
||||||
return subscribedPeers.includes(libp2pId)
|
return subscribedPeers.includes(libp2pId)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ describe('Pubsub subsystem operates correctly', () => {
|
|||||||
|
|
||||||
// wait for remoteLibp2p to know about libp2p subscription
|
// wait for remoteLibp2p to know about libp2p subscription
|
||||||
await pWaitFor(() => {
|
await pWaitFor(() => {
|
||||||
const subscribedPeers = remoteLibp2p.pubsub.getPeersSubscribed(topic)
|
const subscribedPeers = remoteLibp2p.pubsub.getSubscribers(topic)
|
||||||
return subscribedPeers.includes(libp2pId)
|
return subscribedPeers.includes(libp2pId)
|
||||||
})
|
})
|
||||||
remoteLibp2p.pubsub.publish(topic, data)
|
remoteLibp2p.pubsub.publish(topic, data)
|
||||||
@ -172,7 +172,7 @@ describe('Pubsub subsystem operates correctly', () => {
|
|||||||
|
|
||||||
// wait for remoteLibp2p to know about libp2p subscription
|
// wait for remoteLibp2p to know about libp2p subscription
|
||||||
await pWaitFor(() => {
|
await pWaitFor(() => {
|
||||||
const subscribedPeers = remoteLibp2p.pubsub.getPeersSubscribed(topic)
|
const subscribedPeers = remoteLibp2p.pubsub.getSubscribers(topic)
|
||||||
return subscribedPeers.includes(libp2pId)
|
return subscribedPeers.includes(libp2pId)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user