python-trio/purerpc

Support creating channels on unix sockets

decentral1se opened this issue · 1 comments

I need to read/write from a unix socket in my rpc client.

I had a little dig around and it seems like the current implementation here assumes a tcp stream.

https://github.com/standy66/purerpc/blob/5faa35f2cdf5b36d1398a1aa6a9e681c5344060f/src/purerpc/client.py#L23

Seems like anyio does support unix sockets:

https://anyio.readthedocs.io/en/stable/networking.html#working-with-unix-sockets

I am not sure how you imagine this to work in the current insecure_channel API? Or would it be another API method?

If you provide some direction, I can try to submit the patch. Or otherwise, help test it.

Thanks for this rad library ✋

FYI they pushed a fix for this in the gRPC implementation over at grpc/grpc#5701.

Similar kinda hacky but backwards compat approach to grpc/grpc#5701 might be what I'm hacking around on in decentral1se@0e0cd7a. I've manually tested this and I can connect to a unix socket but some slightly messy threading of a is_unix_socket bool was necessary to inform the underlying logic. I can't seem to send a message yet though 🤔