Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples: add basic pubsub-with-rendezvous example #1738

Merged
merged 4 commits into from
Sep 29, 2022

Conversation

smartin015
Copy link
Contributor

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.

@marten-seemann
Copy link
Contributor

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.

@smartin015
Copy link
Contributor Author

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.

@marten-seemann
Copy link
Contributor

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

Copy link
Contributor

@vyzo vyzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All that looks fine to me.

@BigLep
Copy link
Contributor

BigLep commented Sep 16, 2022

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

@BigLep BigLep added the need/author-input Needs input from the original author label Sep 16, 2022
@smartin015
Copy link
Contributor Author

@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
Copy link
Contributor Author

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!

@marten-seemann marten-seemann changed the title Add basic pubsub-with-rendezvous example examples: add basic pubsub-with-rendezvous example Sep 19, 2022
@marten-seemann marten-seemann removed the need/author-input Needs input from the original author label Sep 19, 2022
@smartin015
Copy link
Contributor Author

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

@MarcoPolo
Copy link
Collaborator

Thanks @smartin015 :)

@MarcoPolo MarcoPolo merged commit 7828f3e into libp2p:master Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants