Introduction to gRPC

For the past many years, we have been using Rest Based Communication. As we know that REST is a flexible architectural style where the client communicates with the server through HTTP.

Recently, a new framework for client-server communication has been invented in the industry which we know as gRPC.

What is gRPC, and how does it work, let us know through this article.

What is gRPC?

gRPC is a framework given by Google.
It provides a modern and elegant way to make remote procedure calls. It supports remote procedure calls from languages ​​like Java, Python, Go, Dart etc.

introduction to grpc

What are the benefits of using gRPC?

Although there are many protocols and frameworks available in the industry for remote procedure calls, what is special about gRPC that makes it different from the others?
Let us know what are the benefits of using GRPC for us.

  • gRPC uses HTTP/2 for its transport protocol.
  • gRPC is a language-independent framework, a client of Java can call a resource available on the server which is built in Python or any other language. Isn’t it fun to use gRPC ?
  • The serialization process is faster in gRPC compared to the REST architectural style.
  • gRPC uses a different encoding process so that the data is no longer human-readable and becomes very secure.

How does gRPC work?

Like other RPC systems, the purpose of gRPC is to define the service and specify the method that can be called remotely with its parameters.

In the gRPC process, the server creates an interface that is capable of handling client calls. And on the client side, the client has a stub which provides a method just like the method of the server.

As each RPC uses a protocol, gRPC is no different and also uses a protocol which we call protocol buffers.

What is Protocol Buffer?

Protocol Buffers is Google’s own open-source mechanism that works to serialize structured data. We can use this with JSON data format as well.

To work with Protocol Buffers one has to first define the structure of the data in a file called a proto file.
A proto file is a text-based file with the extension .proto.

gRPC with .NET Core

gRPC is integrated with .NET Core 3 and above versions.
You need Visual Studio 2022 or Visual Studio Code to develop it in .NET Core. If possible, work with their latest updates only.

Follow this link – Quick Start gRPC with C#

In Visual Studio there is a project template for gRPC.
When you create a project for a gRPC in Visual Studio 2022, its structure will look like the picture below.

.proto file contains the below content –

syntax = "proto3";

option csharp_namespace = "GrpcService1";

package greet;

// The greeting service definition.
service Greeter {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply);

// The request message containing the user's name.
message HelloRequest {
  string name = 1;

// The response message containing the greetings.
message HelloReply {
  string message = 1;

In upcoming articles, we will see gRPC in detail. So, keep following SharePointCafe.Net

Please follow and like us:

Leave a Comment