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

Added an example for a multi-protocol app using strongly typed data and protobufs #249

Closed
wants to merge 0 commits into from

Conversation

avive
Copy link
Contributor

@avive avive commented Nov 27, 2017

Here's a little examples that shows how to build a node with multiple app protocols using protobufs as the wire format. The example creates a node that implements two protocols - ping and echo and the example demonstrate exchanging methods using the two protocols between two peers.

@avive avive changed the title Added multi-protocol using protobufs example Added an example for a multi-protocol app using strongly typed data and protobufs Nov 27, 2017
@avive avive mentioned this pull request Nov 27, 2017
enc := protobufCodec.Multicodec(nil).Encoder(writer)
err := enc.Encode(data)
if err != nil {
log.Fatal(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

log.Fatal will halt the program immediately, we would never get to return false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch - got rid of all log.Fatal in latest check-in

Copy link
Contributor

@hsanjuan hsanjuan left a comment

Choose a reason for hiding this comment

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

I had a rather quick look. I don't see anything wrong or hard to follow. Seems a good example to me, very illustrative!

There are a couple of commented lines and todos which we might want to clean-up, but they don't bother me much.

Thanks!

@avive
Copy link
Contributor Author

avive commented Nov 29, 2017

I'd like to do some cleanups before this can be merged. I will commit here when I think this is 100% ready for merging. For example, unrolling GX imports to their canonical names. ok?

@avive
Copy link
Contributor Author

avive commented Nov 29, 2017

I can't really get the example to go build when replacing the GX deps with the canonical github repo names. Can one of you guys help me out with that? I assume we don't want code checkins with GX deps correct?

@hsanjuan
Copy link
Contributor

If you use the canonical github repo, and run gx-go rewrite on the base of this repo, and then try to build it (with the gx-rewritten paths), does it work? In that case, just add that step to the instructions... otherwise you may need to add your own package.json to the example folder...

@avive
Copy link
Contributor Author

avive commented Dec 8, 2017

I'm still having trouble with GX and deps :-(

@Stebalien
Copy link
Member

@avive I believe your problem is the github.com/avive/go-libp2p/... import (two different paths to import the same package). Would you mind if I pushed a version with gx fixes to your branch (gx can be a bit tricky, probably easier to learn by example)?

@Stebalien
Copy link
Member

So... Apparently, force-pushing master to a PR will close it. Worse, because this PR was made master to master, it appears that I can't reopen it. New PR: #280.

marten-seemann added a commit that referenced this pull request Apr 22, 2022
use the Resource Manager
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.

None yet

4 participants