Pubsub peer discovery

We are using ipfs pubsub. I just noticed that there is a --discover option. See below.

  • From the docs I don’t get what this option does and whether or not it is enabled by default. I took a quick look at the go source code, and from my limited understanding of go it seems that the option is disabled by default, and it will connect to additional peers that are somehow looked up (in the DHT?) if the option is enabled. Is that correct? What’s the downside of always using this option?

  • We use the go-ipfs api from javascript using fetch. How would I use this option in this case? Is the query below correct? Or is it just &discover? The REST api does not seem to do any kind of error checking, so it is a bit hard to notice if you pass parameters that it does not understand.

curl 'http://localhost:5001/api/v0/pubsub/sub?arg=THETOPIC&discover=true'
  • will this option be retained once gossipsub is merged?

$ ipfs pubsub sub --help
USAGE
  ipfs pubsub sub <topic> - Subscribe to messages on a given topic.

SYNOPSIS
  ipfs pubsub sub [--discover] [--] <topic>

ARGUMENTS

  <topic> - String name of topic to subscribe to.

OPTIONS

  --discover bool - try to discover other peers subscribed to the same topic.
1 Like