gRPC — Clients

Implementing a gRPC client in NodeJS

KRISHNA KISHORE V

--

In the previous article, we have implemented a gRPC server in Java. We keep that running and use different clients to send the request to this server. As I mentioned in the previous article, there are different types of clients to deal with gRPC servers.

  1. GUI Client
  2. CUI Client
  3. Own Clients programmed by developers.

1. gRPC GUI Clients

There are many gRPC GUI clients. We’ll use one of the old clients which is Bloom RPC. Note — The Bloom RPC project is archived and is not being maintained now. Nonetheless, it is very simple and serves our purpose well. I am still using the Boolm RPC without any trouble and we will now see how we can send the requests using Bloom RPC.

First things first. Install Bloom RPC following this link: https://github.com/bloomrpc/bloomrpc/releases/tag/1.5.3

The UI looks like the below GIF.

Now the .proto files are to be loaded into the tool. Why?

Well, we already mentioned that both the client and server need to agree upon the message format that they are dealing with. So the server is already up and running with Students.proto file loaded in the previous article. Now it is the client’s turn to use the same protos and generate the stubs from its own application.

  1. So, open the Bloom RPC application. Click the plus icon as shown in the above GIF and load the students.proto file that you have used in your Java gRPC server project.
  2. The next step is to use the URL in the address bar. Use localhost:8080 or 0.0.0.0:8080.
  3. When you load the .proto file, Bloom RPC will show all the RPC methods that are defined in that proto. Select the SaveStudent proto.
  4. The best thing about this tool is that it auto-populates a sample request object which we can just modify and click on the run button.
  5. The request now goes to the java gRPC server, which processes it and returns the response. That response is displayed back on the Bloom RPC — The right part of the above GIF.

Here is the image that I used in my local workspace.

--

--

KRISHNA KISHORE V

Full Stack Tech Lead | Software Consultant | Technical Content Writer