GRPC Objective-C  1.26.0
gRPC command line tool

Overview

This document describes the command line tool that comes with gRPC repository. It is desirable to have command line tools written in other languages roughly follow the same syntax and flags.

At this point, the tool needs to be built from source, and it should be moved out to grpc-tools repository as a stand alone application once it is mature enough.

Core functionality

The command line tool can do the following things:

The command line tool should support the following things:

Code location

To use the tool, you need to get the grpc repository and make sure your system has the prerequisites for building grpc from source, given in the ../BUILDING.md "installation instructions".

In order to build the grpc command line tool from a fresh clone of the grpc repository, you need to run the following command to update submodules:

git submodule update --init

You also need to have the gflags library installed on your system. gflags can be installed with the following command: Linux:

sudo apt-get install libgflags-dev

Mac systems with Homebrew:

brew install gflags

Once the prerequisites are satisfied, you can build the command line tool with the command:

$ make grpc_cli

The main file can be found at https://github.com/grpc/grpc/blob/master/test/cpp/util/grpc_cli.cc

Prerequisites

Most grpc_cli commands need the server to support server reflection. See guides for Java , https://github.com/grpc/grpc/blob/master/doc/server_reflection_tutorial.md "C++" and https://github.com/grpc/grpc-go/blob/master/Documentation/server-reflection-tutorial.md "Go"

Local proto files can be used as an alternative. See instructions below.

Usage

List services

grpc_cli ls command lists services and methods exposed at a given port

List methods

Inspect message types

We can use grpc_cli type command to inspect request/response types given the full name of the type (in the format of <package>.<type>).

Call a remote method

We can send RPCs to a server and get responses using grpc_cli call command.