gRPC Node.js OS Question

16 views
Skip to first unread message

Ian Crena Geckeler

unread,
Jul 14, 2019, 9:27:46 PM7/14/19
to grp...@googlegroups.com
Hello Google gRPC Team!

My name's Ian, and I have a quick question about gRPC-Node. 

On the documentation, InterceptorProvider is listed as a global method however, my team cannot find that method on the grpc object. 

Any insight into how to access this method, or how else we might define interceptors and attach them to a service-method on the client/stub would be super helpful. Thank you, and have a terrific week!

Best,
Ian
--
Ian Geckeler
USC | Class of 2019
Computational Mathematics

Michael Lumish

unread,
Jul 15, 2019, 1:22:14 PM7/15/19
to Ian Crena Geckeler, grpc.io
This is one area where our API documentation is not great. interceptorProvider is a function type, not an exported function. In the Client constructor options parameter, two of the available options are "interceptors" and "interceptor_providers", which take an array of Interceptors and an array of InterceptorProviders, respectively.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CABO788vSEMfTKWMe6j76sj5jO_d7UR-xgfLX6PVapnn1-KNfgg%40mail.gmail.com.

Ian Crena Geckeler

unread,
Jul 17, 2019, 5:42:55 PM7/17/19
to Michael Lumish, grpc.io
Thank you for this response Michael, this has been super helpful and we've been able to fully implement interceptors now! I actually had another question and was wondering if you might be able to provide a bit of direction for me. Any thoughts would be awesome! Here's where we're at:


I have a server-side streaming service-method on the client.


const numberStream = stub.streamNumbers(
  
{ number: 5 },
  meta
,
  
{
    interceptors
: [interceptorProvider]
  
},
  
{}
);



When I cancel the method from the client with...

numberStream.cancel()



My client side interceptor detects a cancelled event. But my server remains unaware of the cancellation.

The cancelled property remains "false", and my event listener for
call.on("cancelled",()=>{


})


does not fire. Any chance you might know where my problem lies?

(snippet from server side streaming service method)

function streamNumbers(call) {


  call
.on("cancelled", () => {
    console
.log("cancelled");
    call
.end();
  
});


  console
.log(call.__proto__.__proto__);


}
Reply all
Reply to author
Forward
0 new messages