grpc-web-devtools
grpc-web-devtools copied to clipboard
Use grpc-web interceptors
since they are interceptors they can now be chained properly as well. updated examples and docs. I also took the opportunity to update the dependencies and make a few minor tweaks like an stop icon for an EOF status.
usage is:
const devInterceptors = window.__GRPCWEB_DEVTOOLS__ || (() => {});
const {
devToolsUnaryInterceptor,
devToolsStreamInterceptor,
} = devInterceptors();
const opts = {
unaryInterceptors: [devToolsUnaryInterceptor],
streamInterceptors: [devToolsStreamInterceptor],
};
const client = new EchoServiceClient('http://myapi.com', null, opts);
We operate in a corporate environment so all of our chrome extensions have to be whitelisted. Therefore we aren't able to manually install the fork from @jrapoport. Anything we can do to get this fixed merged as soon as possible would be wonderful as we just currently cannot use gRPC-Web Developer Tools. Let me know if there is any way we can help.
Be aware this piece will break when trying to destructure if __GRPCWEB_DEVTOOLS__
is not there as this piece (() => {});
will return undefined.
const devInterceptors = window.__GRPCWEB_DEVTOOLS__ || (() => {});
const {
devToolsUnaryInterceptor,
devToolsStreamInterceptor,
} = devInterceptors();
Be aware this piece will break when trying to destructure if
__GRPCWEB_DEVTOOLS__
is not there as this piece(() => {});
will return undefined.
fixed the example to recover gracefully if you run it without installing the tools.
Hey @rogchap ,
Do you guys plan to merge this one? gRPC interceptors are a very clever solutions to many problems. On the other hand, gRPC-web devtools saves our lives every day. Right now we had to disable it because we need interceptors.
Is there any way we can help here?
Hi,
Can someone share the status of this MR? We use grpc-web-devtools
at our company, but unfortunately it does not work well with gRPC interceptors.
merged this change into my fork's master and updated the readme to reflect the change. I'm dropping a link here for anyone that finds this and wants to use native gRPC-Web interceptors: https://github.com/jrapoport/grpc-web-devtools
cc: @ickata @FeNoMeNa @iCovarrubias
@jrapoport that's great, however I still think that your fix must become part of the official extension...
Considering it’s (nearly) a complete re-write i guess depends on your pov. i broke the fork history and bumped to 2.0 for that reason.
any updates?