{"_id":"@dao-xyz/libp2p-pubsub-peer-monitor","name":"@dao-xyz/libp2p-pubsub-peer-monitor","dist-tags":{"latest":"0.0.19"},"versions":{"0.0.19":{"name":"@dao-xyz/libp2p-pubsub-peer-monitor","version":"0.0.19","description":"Peer monitor","type":"module","license":"MIT","main":"lib/esm/index.js","module":"lib/esm/index.js","types":"lib/esm/index.d.ts","exports":{"import":"./lib/esm/index.js"},"publishConfig":{"access":"public"},"engines":{"node":">=16.15.1"},"devDependencies":{"@dao-xyz/peerbit-time":"^0.0.19"},"scripts":{"clean":"shx rm -rf lib/*","build":"yarn clean && tsc -p tsconfig.json","postbuild":"echo '{\"type\":\"module\"} ' | node ../../../node_modules/.bin/json > lib/esm/package.json","test":"node ../../../node_modules/.bin/jest test  -c  ../../../jest.config.ts --runInBand --forceExit","test:unit":"node ../../../node_modules/.bin/jest test  -c  ../../../jest.config.unit.ts --runInBand --forceExit","test:integration":"node ../node_modules/.bin/jest test -c  ../../../jest.config.integration.ts --runInBand --forceExit","test:browser":"npm run build:tests && mocha-headless-chrome -t 360000 -f ./test/browser/index.html -a no-sandbox","benchmark":"nyc  --require ts-node/register benchmark-runner -r -b --baselineLimit 1000","benchmark:stress":"benchmark-runner -r --grep stress"},"localMaintainers":["dao.xyz"],"gitHead":"370cd11b1ac189a4c66874e9e9fe2db18fbfbe20","_id":"@dao-xyz/libp2p-pubsub-peer-monitor@0.0.19","_nodeVersion":"18.0.0","_npmVersion":"lerna/5.6.2/node@v18.0.0+arm64 (darwin)","dist":{"integrity":"sha512-gZrhL00VlK3nKwsBJsC9kXH3WNM32MWAmhmbdDTLCPw6MU6ii40/JvZLE+VDApbvZPkhPftUf+JlEQP6fTG/Tg==","shasum":"333bf79f9c47608518594f3b837ff1e5e6a2d81f","tarball":"https://registry.npmjs.org/@dao-xyz/libp2p-pubsub-peer-monitor/-/libp2p-pubsub-peer-monitor-0.0.19.tgz","fileCount":8,"unpackedSize":12818,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBUpIl9snxCHDCjhSwOu3NokQUOQFhZJY3kMokfF7FrtAiB2VvOOpqj9u3zT7eWOKFGFeSjNTFKehKbET714l9WHzg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjkv8jACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpAgg//Q3Ol+4BA6zgMUUD4bNJ9R0SEhZvClLpGG0pw0PUXB9o/mlnw\r\nEAA7M2X7jDzRH5PaWEwBCYrnAyKviQj07vcFbeJhLLKI5nrabaK7UqovN88e\r\nexyvhoBIGeNI5Y6n4g/B2A/NP/xlU31MBAqdpcClHZG8156bk3wLAj9JhCRB\r\nE5+/Q6LYZIFK4xioEK4WDtfffGrmOdfdwrPRMfpXVl9MUevR+pxtGAeG00Vi\r\nN53zlB97wBgo5nRMBkCBNmRgzZhXK3EdfOXUGWlBlbUc9KAy6T4dJYYZOCDj\r\nb9WksKce3uyegpc06ffF09OjIRXmehGlez86295b5yRw+y2yX5HbraMaFcuW\r\ncwc+NfpZLyXyyrJZe2KK5nE7/yusq6WynQtHvGTicEPtKFU6yrtn+kHSu9mL\r\nzDSIwdl+Am9jv3CCPeEudB+K+/HjL+Bv680oBSqAnvg0NW9yF/d2hukwgMDG\r\nbWCTXpA2euSiRpErSTpg2eyHV7HgsKql3lJJqdfDAz9yggmI5fR0El1eFL2z\r\nkKk8pqcpZe1tFnHgLe4KEpg0BsGOwJIHBlkWIAmCrdbJ+4zoEWlLzqIZgAPt\r\nkAeeSkuDRUpUdj5IpRfQL8+mOGYyYClNQeoScXMK5/+o8H9msmnK0x/W35rW\r\n5OZAezT3QnpxZtufxq5jBm1Og42oRPepIzk=\r\n=/7yr\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"marcus.pousette","email":"marcus.pousette@live.com"},"directories":{},"maintainers":[{"name":"marcus.pousette","email":"marcus.pousette@live.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/libp2p-pubsub-peer-monitor_0.0.19_1670577954846_0.8846782277775227"},"_hasShrinkwrap":false}},"time":{"created":"2022-12-09T09:25:54.779Z","0.0.19":"2022-12-09T09:25:55.016Z","modified":"2022-12-09T09:25:55.194Z"},"maintainers":[{"name":"marcus.pousette","email":"marcus.pousette@live.com"}],"description":"Peer monitor","license":"MIT","readme":"# ipfs-pubsub-peer-monitor\n\n> Know when peers are joining and leaving an IPFS PubSub topic\n\n`ipfs-pubsub-peer-monitor` listens on a [IPFS PubSub](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/PUBSUB.md) topic and emits an event when a peer joins or leaves the topic.\n\nThis module is based on [ipfs-pubsub-room](https://github.com/ipfs-shipyard/ipfs-pubsub-room) that can provide the same functionality. It contains extra features that are not necessary for purely wanting to know joins/leaves, so this module was created to do that and only that.\n\n## Usage\n\n```js\nconst PeerMonitor = require('ipfs-pubsub-peer-monitor')\n\n// Get an IPFS instance somehow\nconst ipfs = ...\n\n// Topic to monitor\nconst topic = 'abc'\n\n// Make sure to subscribe to the channel before monitoring it!\nipfs.pubsub.subscribe(topic, (message) => {}, (err, res) => {})\n\n// Pass an IPFS pubsub object and the topic to the monitor\nconst topicMonitor = new PeerMonitor(ipfs.pubsub, topic)\n\n// When a peer joins the topic\ntopicMonitor.on('join', peer => console.log(\"Peer joined\", peer))\ntopicMonitor.on('leave', peer => console.log(\"Peer left\", peer))\ntopicMonitor.on('error', e => console.error(e))\n```\n","readmeFilename":"README.md"}