-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(transport): Add Router::into_service
#419
Conversation
Route between http server and multiple grpc servers
Thanks for taking this over; I’ve had a wild few months and haven’t been able to close this out |
I also ran into the need of having the gRPC server alongside a warp HTTP server on the same port(might even need websockets?) and wanted to know how feasible it is and if it would require work only on tonic's side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, left some nits on docs, otherwise I think we can merge this! Thanks!
Taking updates from PR feedback for RouterService & .into_service()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Router::into_service
Motivation
Coincidentally I was going to open an issue for this after spending some time on my own trying to accomplish this, but #410 was on the first page.
I wanted to help merge #272 since it appeared to be slightly stalled. I have a need for the functionality of running an HTTP server and a gRPC server with multiple services on the same port.
Solution
The major work appeared to be complete and was appeared to be an acceptable implementation. The finishing code was actually provided in #272 (comment) so I just barely provided work. It was a successful group effort overall.
I rebased the PR branch w/ respect to the original author @cthulhua (with a minor change the import of
futures_util::Future::Either
) and moved theservice
function into the Router impl as per the original feedback.Testing
Additionally, I added a new example
hyper_warp_multiplex
, a mix of thehyper_warp
andmultiplex
examples.cargo run --bin hyper-warp-multiplex-server
cargo run --bin hyper-warp-multiplex-client