-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Expose the raw connection from grpc server #2456
Comments
@vishal-uttamchandani In gRPC, the client is responsible for ending connections, since it's typically the client that knows whether more requests might be sent. Do you have a use case where this doesn't work well? |
Essentially, I would like the server to be able to close the connection, if based on some business logic it decides that a particular client does not meet all the criteria to proceed. |
@vishal-uttamchandani connection-level controls on the server should typically be implemented in a handshaker. Once the connection is allowed, the client is responsible for ending the connection when it is no longer necessary. Technically, you could pass data from the handshaker in Let us know if you have any further questions. |
@dfawley thanks for the info. My scenario is one where we don't trust the client to do the right thing and close the connection in time. This means even when the server work is done it will have to hang on to the connection. At scale, this means waste of resources. Any suggestion regarding this ? |
Even if you close the connection, the client will reconnect eagerly. In the future, we will detect idleness and have the client not reconnect, but that is not yet implemented. Another option for you would be to use https://godoc.org/google.golang.org/grpc/keepalive#ServerParameters |
I maybe wrong but after going through the code, I don't see a way to access the raw connection from grpc Server. Is there a way on the server side to close a connection while leaving others open ?
Scenario:
Client connects to the server
Server does some work on behalf of the client. Sends data back to client
Client acks that it is done processing the message.
Server closes connection to the client (or if the timeout expires, connection closes anyways)
The text was updated successfully, but these errors were encountered: