-
Notifications
You must be signed in to change notification settings - Fork 238
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
Does GRPC support setup service and client at same channel with a transport (TCP connection) #211
Comments
I‘m not sure if I understood your request correctly. You are looking for a way, to have the client connect to the server (so that the server knows how to send messages to the client without knowing the IP) but don‘t want to have any client API? This would be realizable through Server-Side Streaming.
You can have a oneof for your response to have multiple different responses on the active connection. These can be full messages. By using gRPC itself has a keep-alive mechanism to keep channels alive and also reconnection mechanisms with exponential backoff if the connect gets lost. So you don’t have to do this in your API. |
No, I mean is there another way, the grpc in a process like A run as both client and service at same time, also share same tcp connection. Thus, remote service B can call A like A call B. |
AFAIK only by using a Bi-Directional Stream. You can have multiple services running on one endpoint. But using the same channel can only be done through one service. AFAIK there is also no other way to attach to an existing channel. |
If it's helpful, there has been some discussion of "tunneling" in gRPC Core issue #14101. |
WoW, wonderful, thanks everyone's feedback. My draft code try is following, please help review: [draft design] A-s: the grpc service run in device side Following is the data flow: |
From example and kinds of code, I know client setup channel by provide a transport, then call the service. If service want to send data to client at real time, we had to let client maintain the stream call on the channel thru hearbeat. In fact, in most of time, service do not need send data to client. So seemed, it waste some resource to maintain the status in standby.
Also, the API to send data to client seemed not reasonable, and I expect service can call client thru RPC like client did.
So, this is the most popular usecase, However, in my device(run as client), which it has no public ip in internet, so it is no way to setup service (I expect my device run as both client and service) in my device side. Is it possible, client side can setup a service which the server side can call it? In code, Can we setup a service by reuse the channel under a stable transport used already by client call?
I just need a possibility of GRPC protocol, if it is yes, I can deep go thru the grpc core to target this implementation.
Thanks,
Tom Xiao
The text was updated successfully, but these errors were encountered: