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

Use stream behaviour instead of request-response #141

Open
Tracked by #138
kalabukdima opened this issue Jan 20, 2025 · 2 comments
Open
Tracked by #138

Use stream behaviour instead of request-response #141

kalabukdima opened this issue Jan 20, 2025 · 2 comments
Assignees

Comments

@kalabukdima
Copy link
Collaborator

kalabukdima commented Jan 20, 2025

https://github.com/libp2p/rust-libp2p/tree/master/protocols/stream

@kalabukdima kalabukdima self-assigned this Jan 20, 2025
@kalabukdima
Copy link
Collaborator Author

The stream protocol looks much better than request-response. It has a simpler implementation and a better interface which suits our needs just right. For example, it's easy to propagate the back pressure while still using it from multiple threads.
On the client side, you just request a connection to the peer and await the future to get the raw Stream which can be handled independently of every other stream, without locking the Swarm. So there is no need for any request caching inside the behaviour and matching request/response ids, making it much less error-prone.

Luckily for us, it's fully compatible on the wire with the request-response, so the transition will also be easy.

@kalabukdima
Copy link
Collaborator Author

Implemented in #145

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

No branches or pull requests

1 participant