{"bugs":{"url":"https://github.com/ChainSafe/gossipsub-js/issues"},"dist":{"shasum":"4d2514cd4c321366f7966c44512a41c6f579e901","tarball":"https://registry.npmjs.org/libp2p-gossipsub/-/libp2p-gossipsub-0.4.1.tgz","fileCount":21,"integrity":"sha512-QIFWKVW8ZTmLuTPbScYdazoI6pBE2l8fnyQiskjo8VU7zaQ/cf5ge3+6btcPDzlJKQoBpjVNajeEpfIUqczUbA==","signatures":[{"sig":"MEUCIQDEutjUDHj9mZU/XyvkVVyHkhpdkJjgwMIBb6v4qubOzQIgNyDDXHftr4XJi6ZbK3km6jG48GFeUwWSRx+f5XUX4UY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4839281,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJezpo1CRA9TVsSAnZWagAAKL4P+gP3e8LYmkW9XdJ4eOKl\nkTqjULyVYzj5v91Y8akx4qsdrZ4hHTc+m18Chpku2z5oaml+C/FUCkF0kynp\nGRqBVuuo4KuH01MG7H7o2aQdxd6OFV5Uyk8s3cGvsRGWFX14YQHaGfwmDZBv\nDutL06cuxOyni6ilVwH2WQz3W30wK8tcYqFZk8OGGm5IdwTFrZfwhFCk90la\nHqn5vYjJkcU7qHG7XKDcLHKtFGO4Nc5b+sGbtpQi/ijBu2BmI2b4rwDGd4dD\nna4F7lONaKTJvLKOFFR0gV+J2JjM7iYReYwwNJ3uJjntcPMoIBSezwMC9P85\nNK2iTxwEQ6hrg03evAddTne3OTt8OK7+3/4Ml5278s6tbJwkb/4cs09hPmcR\nhn6EhwRwPlIVHvq0dx0TCqeVTfqcoxOwOp1EfTqBCx6MCp+nTs3cYcSCBxCl\nj/3vlmwEMlp+JdYqR+RwsiH6JzdGW2PrSvT2ureQAYWm0YbnKpB4oQIcJIcW\nSDGvruXOXqoU3UkuFXKpsolwVyUnqr/572TNyooc//qmXfN7NxDuEQHM1oiJ\nGZVaI2nBqIa13Mtm+D+sEewoeBV7o/5/PX+ob1Mn5oznYC1nHntuHVCoWpA/\nptp/uJe33ehBNxzMdsrDGM7jBJkOVPwH70v8Bf56XGAQnSIcdFabXKszVO3l\nu/L2\r\n=p/HD\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":"05fbf3c038a2818147a930f6d6c71d77712cd6f8","license":"Apache2.0","scripts":{"lint":"aegir lint","test":"aegir test","build":"aegir build","release":"aegir release","test:node":"aegir test --target node","test:browser":"aegir test --target browser"},"_npmUser":{"name":"wemeetagain","email":"caymannava@gmail.com"},"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.12.1","description":"A javascript 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.13.1","contributors":[{"name":"Cayman","email":"caymannava@gmail.com"},{"name":"Mikerah","email":"mikerahqc@protonmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Alan Shaw","email":"alan.shaw@protocol.ai"},{"name":"Tuyen","email":"tuyen@wetrust.io"},{"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":"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.3","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","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","@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"},"_npmOperationalInternal":{"tmp":"tmp/libp2p-gossipsub_0.4.1_1590598196741_0.5684788328097492","host":"s3://npm-registry-packages"},"_id":"libp2p-gossipsub@0.4.1","version":"0.4.1"}