grpc / grpc/grpc-node

Access underlying client socket in grpc-js

Open
#1,660 3 comments 1 reaction 0 assignees View on GitHub
enhancement package: @grpc/grpc-js
Dominant language
TypeScript
Stars
4.8k
Forks
716
Avg merge
2d 3h
Merged PRs (30d)
10

Description

### Is your feature request related to a problem? Please describe.
We are using the `grpc-js` client to connect over a Windows Named Pipe. Due to changes last year, this works great now, thanks! One additional requirement we have is to verify that the named pipe is owned by root. We don't expect this library to do that, but in order for us to verify that we need access to the underlying socket/file descriptor.

### Describe the solution you'd like
Is it possible to register a callback that can be called on socket connect events that might give the caller access to the newly created socket?

We would be willing to make this change if there's a chance it would be accepted.

### Describe alternatives you've considered
About this time last year, I could hack in a `createConnection` callback which would let me create the socket myself. With that object I could then do the required validation. Changes to the `Subchannel` have closed that hack, so we're looking for an alternative now.

I am currently looking into whether I can use `channelFactoryOverride` or `channelOverride` to possible create a subchannel that I can call `addConnectivityStateListener`, but even then I don't think I can get access to the socket.

I also considered creating the socket outside of `grpc-js` and passing an `fd` option along which I think will make it all the way down to `net.Socket(options)`, but that won't handle reconnects at all.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.