{"bugs":{"url":"https://github.com/ChainSafe/gossipsub-js/issues"},"dist":{"shasum":"5b3de6593130d5f2d362ec5f1c162d70571d8e3a","tarball":"https://registry.npmjs.org/libp2p-gossipsub/-/libp2p-gossipsub-0.4.0.tgz","fileCount":18,"integrity":"sha512-dw1qLmWnGw4FX6QyuTZSYQSXBUF+DI2x1tycJAlVb28NPpgmJI/vf33w+Gm7cPXMo1wCtnrJbBwbmVr//oRWMw==","signatures":[{"sig":"MEYCIQCGX+Iwqpc0/fSLwlRJ43mxAv80Vij8Zj+DPfx5G44hpAIhAJT3fB4R+8h62XvuHtsVAN/Z71e3bCUrKCTFRBIb/Tzr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4838788,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeobkCCRA9TVsSAnZWagAA/VEP+wd8xgWtLqjzlWgguiZj\n7reTbWLPXXZGWG35o1nhV2OxdMJNUwPjon6Ue7//IMcvXTetRxZwMoRN14S6\nbcIKdZ6YV4tyLbQLfvqYg7vnwytYoK/v5hqhmMwFa//erSLt5c1rthAcf94S\nd5K8J0FO6xCFnM0eZTZY2IPpAcUrhmt4gatKoRWTCnoOdm0qbassHu3AWIPI\nYqYYas8XDjvWsKBkSHTBqe/pMy5h104dyT/ie32G9WlOXV5SvagxYDtq8z1b\nSibOHEOaadyL9dxP7rEDFhaZwLjKruRWXYEma49mqZ0jt2b+uLtHZtLXwisX\nfE7RfQzEExzS3xt28wNWJFalV2BSzzVGNA99I8p8bbsVRdNvwJV0QVf1sRUq\nFzyXrH2maBr17S5/0eqY0xgQnXtlinq50Zt0Owpmr6FgztSyk6gxHitF8IzH\nBc8c0rz4UGrX5lbroLjeoGqGlOFaqbapGcrGf/fFqVfByHpJe0sVcbrpOIoR\nEDVOR+0zY6tqhPdw3uu4FZlYJCy8pobmgtD+pWlB6i7Ka0nVF7fgERLRnD7D\n97nVKF92dDBTGt7LH+Tgas49Wc05hNmv4uWeeu+i/IEaG23znn9Yl1+8k0jS\n5WXP4fk3DH88jUu96bjf81KwClWPRQooXsndGpJ6EPtB6dfSGgfmrDSIYloX\nWOSa\r\n=6P2O\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":"aafe59aa84cb78b367bcfaf26c8df94fe80c4a30","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.9.0","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.0_1587656961919_0.4818705303632884","host":"s3://npm-registry-packages"},"_id":"libp2p-gossipsub@0.4.0","version":"0.4.0"}