-
Notifications
You must be signed in to change notification settings - Fork 420
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
Send a status with initial metadata #263
Comments
Thank you for the suggestion! My I ask what your goals are with such a change? I.e. when do you need to send custom In general, the request flow in Swift GRPC is this:
If we were to extend this, I think it would make the most sense to improve support for sending custom trailing metadata, as the initial metadata is sent very early, before the actual handler implementation is even called. |
I understand. It is not good to extend In Please reference ServiceServer.swift#L88-L97. |
But that branch is only called when there is no handler to handle a method with the given name. Why do you need to send metadata in that case?? |
I just want to change following: try handler.call.perform(OperationGroup(
call: handler.call,
operations: [
.sendInitialMetadata(Metadata()),
.receiveCloseOnServer,
.sendStatusFromServer(.unimplemented, "unknown method " + unwrappedMethod, Metadata())
]) { _ in
handler.shutdown()
}) ↓ let status = ServerStatus(code: .unimplemented, message: "unknown method " + unwrappedMethod)
try handler.sendStatus(status) Thanks. |
Thanks! Now I understand what you mean. While https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#responses makes it sound like sending no header should be okay, https://github.com/grpc/grpc/blob/f0375f86e94f9970283e80996e1326b4416ed4da/include/grpc/impl/codegen/grpc_types.h#L487 makes it sound like |
Thank you for understanding. So, are not you planning to implement a dedicated method to send |
What would be the benefit of that?
… On 7. Jul 2018, at 18:18, Kyohei Ito ***@***.***> wrote:
Thank you for understanding.
So, are not you planning to implement a dedicated method to send .unimplemented status on Handler?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Core components can be hidden more. However, I think this is not a big benefit. I think Core should be more privately and Runtime should be more publicly. |
Thanks for the explanation! I would still keep the option open for users of SwiftGRPC to build their own, lower-level SwiftGRPC server, so I would like to not reduce the visibility of our methods. However, I would not be opposed to adding one method to If you are interested in further improving the quality of SwiftGRPC, I'd encourage you to look into the ideas listed in #189. |
Thank you for the discussion. I'll check the issue. |
Closing this now; please open a new issue if this is still relevant for the |
I think it would be better to implement the following methods.
https://github.com/grpc/grpc-swift/blob/0.4.3/Sources/SwiftGRPC/Runtime/ServiceServer.swift#L88-L97
For example, extend
sendStatus
ofHandler
method so thatinitialMedadata
can be sent?If you want to need proposal, I will create PR.
The text was updated successfully, but these errors were encountered: