Ejemplo n.º 1
0
        public static GrpcChannel CreateUdsChannel()
        {
            var udsEndPoint        = new UnixDomainSocketEndPoint(SocketPath);
            var connectionFactory  = new UnixDomainSocketConnectionFactory(udsEndPoint);
            var socketsHttpHandler = new SocketsHttpHandler
            {
                ConnectCallback = connectionFactory.ConnectAsync
            };

            return(GrpcChannel.ForAddress("http://localhost", new GrpcChannelOptions
            {
                HttpHandler = socketsHttpHandler
            }));
        }
Ejemplo n.º 2
0
        public static GrpcChannel CreateUdsChannel(MethodConfig methodConfig)
        {
            var udsEndPoint        = new UnixDomainSocketEndPoint(SocketPath);
            var connectionFactory  = new UnixDomainSocketConnectionFactory(udsEndPoint);
            var socketsHttpHandler = new SocketsHttpHandler
            {
                ConnectCallback = connectionFactory.ConnectAsync
            };

            var options = new GrpcChannelOptions
            {
                HttpHandler = socketsHttpHandler
            };

            options.ServiceConfig = new ServiceConfig();
            options.ServiceConfig.MethodConfigs.Add(methodConfig);

            return(GrpcChannel.ForAddress("http://localhost", options));
        }