ChainSafe / js-libp2p-gossipsub

TypeScript implementation of Gossipsub
Apache License 2.0
151 stars 43 forks source link

GossipSub with libp2p v2 #510

Open julienmalard opened 4 weeks ago

julienmalard commented 4 weeks ago

Since the autodialer has been removed in libp2p v2, I have been unable to get peers to communicate over gossipsub (they discover each other, but do not dial or connect). What would the recommended best practice be to get peers to dial each other after discovery?

wemeetagain commented 3 weeks ago

@julienmalard It really depends on your application. You should make your own auto-dialer / peer manager based on your needs. This may be as simple as listening to the appropriate event when peers are discovered, and dialing that peer, or it may include additional logic tailored to your app.

julienmalard commented 1 week ago

Thanks @wemeetagain . I can get connections working again by dialing on each "peer:discovery" event, but I suppose that this is probably inefficient. Is there a way of interacting with the GossipSub mesh and PX algorithms which, as I understand, do manage peer connections according to subscription status and peer behaviour (https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md)? Many thanks!