go-libp2p icon indicating copy to clipboard operation
go-libp2p copied to clipboard

examples: add basic pubsub-with-rendezvous example

Open smartin015 opened this issue 3 years ago • 7 comments

I'm evaluating libp2p's pubsub implementation for coordinating a dynamic number of distributed nodes. I noticed there was a neat (but IMO rather complex and hard to quickly grok) example for pubsub using mdns, but as my nodes could span multiple networks I needed to use rendezvous instead.

This PR is a pared-down example that mashes together pubsub/chat and chat-with-rendezvous, stripping away all of the UI prettiness in order to more clearly show the most basic setup needed to get a shared pubsub topic sent to 2+ nodes.

I haven't yet tested this on multiple PCs / across NAT barriers, but it does work with multiple processes running locally.

smartin015 avatar Sep 04 '22 18:09 smartin015

Does it make sense to exhaust the combinatory space here, and have a pubsub with mdns, a pubsub with rendezvouz, and a chat with rendezvouz example? Every example creates maintenance burden for years to come, and we should only add it if it actually adds value over what we currently have.

marten-seemann avatar Sep 05 '22 10:09 marten-seemann

That's fair - you're welcome to reject this PR, or suggest something else. I just wanted to share the product of a couple hours of trying to work out pubsub with rendezvous in case it was useful to anyone else.

smartin015 avatar Sep 05 '22 11:09 smartin015

@vyzo, what do you think? You're more familiar with our pubsub code.

marten-seemann avatar Sep 07 '22 09:09 marten-seemann

@smartin015 : CI is failing. Can you please investigate to try and get CI to pass?

BigLep avatar Sep 16 '22 16:09 BigLep

@smartin015 : CI is failing. Can you please investigate to try and get CI to pass?

Can do - looks like some deprecation notices are the issue. I'll try to have a fix in by the next couple of days.

smartin015 avatar Sep 18 '22 14:09 smartin015

Okay @BigLep - pushed changes and ran go vet and staticcheck locally with no errors. I didn't see any other issues in the workflow logs. Can you please run them again? Thanks!

smartin015 avatar Sep 19 '22 18:09 smartin015

And yet... apparently I needed to go mod tidy after mucking with the import names. Apologies, that's also now checked in.

smartin015 avatar Sep 19 '22 19:09 smartin015

Thanks @smartin015 :)

MarcoPolo avatar Sep 29 '22 19:09 MarcoPolo