1

In a scenario where the gRPC server doesn't know the URLs of clients in general, but clients know the URL of the (single) server, it would be useful to be able to initiate connections to client endpoints from the server, once a client connects to us.

It might be necessary to actually extract the URL from a connecting client and manually initiate the connection as usual from server-to-client (where server is client in the secondary connection). But there may be a way to connect which abstracts the URL, given that we already have a TCP connection from client to server and some object we could get a handle on.

I don't know which part of the tonic API this functionality would be contained in - if it exists - but it seems it should be possible in principle.

Edit: fwiw client and server will always be in the same network. So NAT considerations don't apply and we can assume any URL would be usable.

jsstuball
  • 4,104
  • 7
  • 33
  • 63
  • Why add tags at the beginning of the question? This is what we have, ah, tags for. – Chayim Friedman Aug 22 '23 at 11:56
  • 1
    Unless client and server are in the same network it's unlikely to work. Over internet most devices are behind NAT routers that hide them from external connections. This is the very same problem that active-mode FTP stumbled upon in modern networks and why it was replaced by passive-mode. Alternative: Open a WebSocket connection from the client, leave it open and let the server talk back whenever it likes on the established connection. – Alejandro Aug 22 '23 at 11:59
  • Point taken about NAT and not being able to extract a usable URL for connecting clients in general, but we already have an established TCP connection - would it be possible to make use of it for a second gRPC connection / multiplex on it? – jsstuball Aug 22 '23 at 13:15

0 Answers0