Skip to content

Make pubsub option emitSelf configurable #401

@a1300

Description

@a1300

First and foremost: Thanks for this great package and the hard work! 👍


  • Version: 0.26.0
  • Platform: Linux Kubuntu-18 4.18.0-25-generic
  • Subsystem:

Type: Feature

Severity: Low

Description:

Currently is the option emitSelf for pubsub packages (libp2p/js-libp2p-floodsub and ChainSafe/gossipsub-js) hardcoded in the code.

const pubsub = new Pubsub(node, { emitSelf: true })

Both pubsub packages support the emitSelf option. It would be nice to add the option to specify if self-published messages should be received.

Example:

export class Bundle extends libp2p {
  constructor(_options) {
    const defaults = {
      modules: {
        transport: [TCP],
        streamMuxer: [Mplex],
        connEncryption: [SECIO],
        peerDiscovery: [Bootstrap],
        dht: DHT,
        pubsub: GossipSub,
      },
      config: {
        pubsub: {
          enabled: true,
+         emitSelf: false,
        },
      },
    };
    super(defaultsDeep(_options, defaults));
  }

Steps to reproduce the error:

Metadata

Metadata

Assignees

Labels

P2Medium: Good to have, but can wait until someone steps upexp/noviceSomeone with a little familiarity can pick upkind/bugA bug in existing code (including security flaws)status/readyReady to be worked

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions