SafetyCulture / grpc-web-devtools

Chrome & Firefox Browser extension to aid gRPC-Web development
MIT License
405 stars 51 forks source link

Usage ? #86

Open kennydefie opened 3 years ago

kennydefie commented 3 years ago

Installed extension and in Usage I see this:

const enableDevTools = window.__GRPCWEB_DEVTOOLS__ || (() => {}); const client = new EchoServiceClient('http://myapi.com'); enableDevTools([ client, ]);

I added the snippet code into my own client.js file and changed client to my respective service and endpoint... reloaded the app inside chrome and I don't see anything being displayed in gRPC-Web under inspect window...

I'm confused on how to use this?

Let me know thanks,

shotexa commented 3 years ago

@kennydefie Have you been able to use it?

keithleungwork commented 3 years ago

In case anyone meet this problem, here is the solution:

The "EchoServiceClient" in document is an example, actually you need to import the service client from the generated xxxx_grpc_web_pb.js

For example, my client is chatServiceClient, so I write like this:

import { ChatServiceClient } from "./protobuffer/chat_grpc_web_pb";
const client = new ChatServiceClient("http://localhost:8080", null, null);

// for debug
const enableDevTools = window.__GRPCWEB_DEVTOOLS__ || (() => {})
enableDevTools([
  client
]);