-
Notifications
You must be signed in to change notification settings - Fork 4
Implement server side gRPC protocol #68
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
Conversation
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
0982e2a to
4c1733c
Compare
…nto grpc-protocol
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
9d4c999 to
7483716
Compare
stefanvanburen
left a comment
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.
doesn't seem like a large lift in complexity to me, and supporting gRPC is huge for the initial transition from gRPC -> connect, so seems worthwhile. great stuff!
src/connectrpc/_protocol_grpc.py
Outdated
| case "n": | ||
| return 1 / 1000 / 1000 | ||
| case _: | ||
| msg = "protocol error: timeout has invalid unit '{unit}'" |
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.
missing f prefix
{unit} won't be interpolated and will appear literally in the error message.
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 for catching these!
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
#49
This implements the server side of gRPC protocol, running tests with pyvoy since it supports trailers. ASGI trailers are an extension defined in the spec and other servers may eventually support them, WSGI there's no definition but pyvoy provides an extension to provide parity between the two.
I know there was some concern about added complexity for supporting gRPC - let me know how it looks. I tried to keep things simpler by noting that gRPC protocol is almost the same as connect's streaming protocol except for error handling - so I didn't touch the unary codepath at all and left it connect-only. If it seems ok, I think it can be great to at least provide server-side support for gRPC to make migration easier than using a proxy server.