-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(example): showcase how to manually compose NetworkBehaviour #5884
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
base: master
Are you sure you want to change the base?
feat(example): showcase how to manually compose NetworkBehaviour #5884
Conversation
Thanks for this effort @drHuangMHT! But looking through the code of this PR, I am unsure if this will really help newcomers. It's 1200 lines of code that are mostly just the expanded I agree that it would be great to have more resources on how to manually compose |
Yes indeed.
Maybe for some, yes. But I'm expecting advanced users to read this. Plus I myself am not very familiar with how
Yes, but there is also timeliness problem with tutorials right?
Some people are more comfortable with a working example. But I have to admit that there is too much boilerplate code. What I write above are not very strong argument for this PR though. Do you think some simple macros will make it better? |
Well, we already have the
You mean with them staying up-to-date? Generally I agree, but I would argue that central concepts when composing network behaviors will stay the same. Generel question: when would one want to manually compose such a "parent" |
I would like to see if it is possible to negotiate protocols dynamically(instead of |
What do you mean with negotiate protocols dynamically? |
So I have this concern: when connecting to an unknown peer, one should leak as little information as possible. I had this misconecption when I was new to rust-libp2p: after the transport has been negotiated, all locally supported protocols will be sent to remote at once to let the remote learn what protocols to speak. Then I wrote my own macros to generate a |
Description
Showcase how to compose
NetworkBehaviour
s manually without the derive macro orEither
.Notes & open questions
Although this is not the recommended approach(see #3902, huge shoutout to thomas by the way), it can show us how the protocols and substreams get negotiated. Suggestions welcome!
Change checklist