The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1.0 KiB

Step-0: define a service

This section presents an example of a simple service definition that receives a message from a remote client. The message contains the users's name and sends back a greeting to that person.

It's shown below in full; it's actually contained in separate file helloworld.proto.

syntax = "proto3";

package helloworld;

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

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

// The greeting service definition.
service Greeting {

  // Sends a greeting
  rpc hello (HelloRequest) returns (HelloReply) {
  }
}

The service stanza of the message is an example of protobuf service IDL (Interface Defintion Language). Here, it defines a simple service that receives a request containing a name and returns a response containing a message.

Next, in Step - 1, we'll use protoc to generate client code from this IDL.