Photo taken on July 10, 2021 shows anji, Huzhou.

introduce

Just see dong Zerun elder brother an article about the use of WireShark analysis of gRPC flow, learned. Tips! Wireshark makes debugging GRPC easy

Then I will introduce the use of two gRPC client debugging tools.

Evans

Evans has two modes of operation: REPL and CLI.

Evans is more expressive than other gRPC clients, and it also supports auto-completion.

Evans is easy to install, and on a Mac you only need to execute the following two lines of commands.

\

\

Let’s take a look at the REPL pattern.

First we need to have a pb file, assuming your file is in API /api.proto, we just need this:

\

\

The default address is 127.0.0.1:50051, and of course you can specify the server by using –host and –port.

\

\

The command above:

  • show packagereadpbThe package name,
  • show serviceThe corresponding service list is displayed.
  • call xxxcallgRPCService…
  • .

More commands can be found on the official website.

In addition to the above direct introduction of PB files, we can also register grPC. Server with reflection service through gRPC Reflection package.

In this case, you can use the reflection service provided by Reflection to query the corresponding gRPC service or directly invoke the gRPC service.

Registering reflection service operations is also simple,

\

\

Going back to the Evans tool, if a gRPC service registers reflection, we can use the -r option to start Evans.

For example:

\

\

Those who are interested in the other mode can check out the official website, which is not demonstrated here.

BloomRPC

BloomRPC is a simple GUI client tool, which is even easier to use with this one.

Just import the PB file and click twice.

\

\

Of course, every time you change pb, remember to reload the file by clicking in the upper left corner.

conclusion

The preceding two gRPC client tools are introduced. I do not know what peripheral tools you usually use gRPC, welcome to discuss.