{"bugs":{"url":"https://github.com/ChainSafe/gossipsub-js/issues"},"dist":{"shasum":"78becae034b9fb159e2bf571b6dd6c5f6984ea59","tarball":"https://registry.npmjs.org/libp2p-gossipsub/-/libp2p-gossipsub-0.4.4.tgz","fileCount":33,"integrity":"sha512-AxxYVwVkOo1oSG2U27P/u9f5W5KxvQ2qWK8NxO/RB03BC1OhqZO2rp6FEc+xrgEsu1T9u63L0qlyqrAZvLu3lw==","signatures":[{"sig":"MEUCIQDPrkfJCgL8ljmPkLOJ58D1KWSmCbhK7T3UksbgSr0NKQIgeIf/10AN1zpaUzePjBN2x0c9R9QF9sF2WWq1roKQAko=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4950984,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe1/agCRA9TVsSAnZWagAAQeEP/Avz/KeHw4slsxo0gDhf\n5UlS1fMz5OQbMk9PCdXR1NurtNeRHeljeRhY5VEth7HWsFY+fNEyyc0AwAUH\nxo5kYMMp4m14btXpIZkiUxsXr2BRFFpUsXBfabiCkjxokJcfgW6PlNzSXs3o\nYIIIhpQ8RcTAgcqN7YptslYMda+jLUsO8CSef6yDbF+ZXAAfxHTU1EvFBBpH\nWfnq/vWQoNlWZYdNbxOf4tESoFbkTuSSoPhFtZ5EPf+4zCxyoNlAb39Irfwn\niW6dpVX3DCZwTT3NJGHfDRO5jkeLL2+9b/02lSj98/YpOPRGi5LxzJFo2sNW\nWPIkKxpVgcKqoSyUyIqmKujOZaPboIHgXHyGHL+/y6gzdkQ/xfixeLIaWnaS\nk7jsZHFQqbDvcWP83cY9tnpIjt3HsGFcPdNNokU992doDac38njCwar3uBUg\nAUoqvbGQ50edPnKh9gNFrSBdiZbWpFqsH3mBsURHg/pEsC4Xclkfyegqumm7\nsB400sC1aL+KzR7uUFE5Wk0hR3JGsbCQ3+sbjQwEi60BbBOy1fklAw2Fxt0m\n7SZ3zE09hB55zuyaXQjfr95fn9Ix3BMkWQDn/zzaGXKOu/jwYZY7lhZjyCR1\nAFZ/owUrPDc5+biczJCPd8IvdnIOzqH5DvEMgtTyjIAqBjmmI44BIHrmqMgk\nrlsn\r\n=vr7v\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","name":"libp2p-gossipsub","types":"src/index.d.ts","author":{"name":"Cayman Nava"},"readme":"js-libp2p-gossipsub\n==================\n\n[![](https://img.shields.io/badge/made%20by-ChainSafe-blue.svg?style=flat-square)](https://chainsafe.io/)\n[![Travis CI](https://flat.badgen.net/travis/ChainSafe/gossipsub-js)](https://travis-ci.com/ChainSafe/gossipsub-js)\n\n## Lead Maintainer\n\n[Cayman Nava](https://github.com/wemeetagain)\n\n## Table of Contents\n\n* [Specs](#specs)\n* [Install](#Install)\n* [Usage](#Usage)\n* [API](#API)\n* [Contribute](#Contribute)\n* [License](#License)\n\n## Specs\nGossipsub is an implementation of pubsub based on meshsub and floodsub. You can read the specification [here](https://github.com/libp2p/specs/tree/master/pubsub/gossipsub).\n\n`libp2p-gossipsub` currently implements the `v1.0` of the spec.\n\n## Install\n\n`npm install libp2p-gossipsub`\n\n## Usage\n\n```javascript\nconst Gossipsub = require('libp2p-gossipsub')\n\nconst registrar = {\n  handle: (multicodecs, handle) => {\n    // register multicodec to libp2p\n    // handle function is called everytime a remote peer opens a stream to the peer.\n  },\n  register: (multicodecs, handlers) => {\n    // handlers will be used to notify pubsub of peer connection establishment or closing\n  },\n  unregister: (id) => {\n\n  }\n}\n\nconst gsub = new Gossipsub(peerId, registrar, options)\n\nawait gsub.start()\n\ngsub.on('fruit', (data) => {\n  console.log(data)\n})\ngsub.subscribe('fruit')\n\ngsub.publish('fruit', new Buffer('banana'))\n```\n\n## API\n\n### Create a gossipsub implementation\n\n```js\nconst options = {…}\nconst gossipsub = new Gossipsub(peerId, registrar, options)\n```\n\nOptions is an optional object with the following key-value pairs:\n\n* **`fallbackToFloodsub`**: boolean identifying whether the node should fallback to the floodsub protocol, if another connecting peer does not support gossipsub (defaults to **true**).\n* **`emitSelf`**: boolean identifying whether the node should emit to self on publish, in the event of the topic being subscribed (defaults to **false**).\n* **`msgIdFn`**: a function with signature `(message) => string` defining the message id given a message, used internally to deduplicate gossip (defaults to `(message) => message.from + message.seqno.toString('hex')`)\n* **`messageCache`**: optional, a customized `MessageCache` instance, see the implementation for the interface.\n\nFor the remaining API, see https://github.com/libp2p/js-libp2p-pubsub\n\n## Contribute\n\nThis module is actively under development. Please check out the issues and submit PRs!\n\n## License\n\nMIT © ChainSafe Systems\n","gitHead":"beaa2258369cd780a096b8c26cf909c8dc08f383","license":"Apache2.0","scripts":{"lint":"eslint --ext .ts ts","test":"aegir test","build":"aegir build","pretest":"tsc","release":"aegir release","prebuild":"tsc","test:node":"aegir test --target node","test:browser":"aegir test --target browser"},"_npmUser":{"name":"vascosantos","email":"vasco.santos@moxy.studio"},"homepage":"https://github.com/ChainSafe/gossipsub-js#readme","keywords":["gossipsub"],"pre-push":["lint"],"repository":{"url":"git+https://github.com/ChainSafe/gossipsub-js.git","type":"git"},"_npmVersion":"6.14.4","description":"A typescript implementation of gossipsub","directories":{},"maintainers":[{"name":"gregthegreek","email":"gregorymarkou@gmail.com"},{"name":"mpetrunic","email":"marin@nodefactory.io"},{"name":"vascosantos","email":"vasco.santos@moxy.studio"},{"name":"wemeetagain","email":"caymannava@gmail.com"}],"_nodeVersion":"12.16.3","contributors":[{"name":"Cayman","email":"caymannava@gmail.com"},{"name":"Mikerah","email":"mikerahqc@protonmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Tuyen","email":"tuyen@wetrust.io"},{"name":"Alan Shaw","email":"alan.shaw@protocol.ai"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"chainsafe","email":"aidan@chainsafe.io"},{"name":"Marin Petrunić","email":"marin.petrunic@gmail.com"},{"name":"ChainSafe","email":"superadmin@chainsafe.io"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"}],"dependencies":{"debug":"^4.1.1","p-map":"^4.0.0","buffer":"^5.6.0","it-pipe":"^1.0.1","peer-id":"~0.13.12","protons":"^1.0.1","err-code":"^2.0.0","time-cache":"^0.3.0","libp2p-pubsub":"^0.5.0","it-length-prefixed":"^3.0.0"},"_hasShrinkwrap":false,"leadMaintainer":"Cayman Nava <caymannava@gmail.com>","readmeFilename":"README.md","devDependencies":{"chai":"^4.2.0","aegir":"^21.10.2","mocha":"^7.1.1","sinon":"^9.0.2","eslint":"^7.1.0","lodash":"^4.17.15","it-pair":"^1.0.0","p-times":"^2.1.0","benchmark":"^2.1.4","chai-spies":"^1.0.0","dirty-chai":"^2.0.1","p-wait-for":"^3.1.0","typescript":"^3.9.3","@types/chai":"^4.2.3","detect-node":"^2.0.4","@types/mocha":"^7.0.2","promisify-es6":"^1.0.3","libp2p-floodsub":"^0.21.0","eslint-plugin-node":"^11.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-promise":"^4.2.1","eslint-config-standard":"^14.1.1","eslint-plugin-standard":"^4.0.1","@typescript-eslint/parser":"^3.0.2","@typescript-eslint/eslint-plugin":"^3.0.2"},"_npmOperationalInternal":{"tmp":"tmp/libp2p-gossipsub_0.4.4_1591211677566_0.697388314375557","host":"s3://npm-registry-packages"},"_id":"libp2p-gossipsub@0.4.4","version":"0.4.4"}