10

Will gRPC support in Python allow me to implement a server that listens on a Unix domain socket (as opposed to a port)? I am using Python 3.5.3 and grpcio/grpcio-tools 1.18.0.

So far, I have not been able to find any relevant example nor direct evidence. The official examples use server.add_insecure_port('[::]:50051'), and its not clear how a socket could fit there.

rookie099
  • 2,201
  • 2
  • 26
  • 52

1 Answers1

10

Apparently add_insecure_port(address) accepts Unix domain sockets in the format unix://var/run/test.sock after all.

rookie099
  • 2,201
  • 2
  • 26
  • 52
  • 4
    To be clear, this would require three slashes. As an example: `channel = grpc.insecure_channel('unix:///tmp/foo/test.sock')` – gohar94 Oct 09 '20 at 05:06
  • 2
    More details on gRPC name resolution can be found [here](https://github.com/grpc/grpc/blob/master/doc/naming.md). – gohar94 Oct 09 '20 at 05:56