You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/guides/concepts.md
+4-5
Original file line number
Diff line number
Diff line change
@@ -66,9 +66,8 @@ We'll look at the different types of RPC in more detail in the RPC life cycle se
66
66
67
67
Starting from a service definition in a .proto file, gRPC provides protocol buffer compiler plugins that generate client- and server-side code. gRPC users typically call these APIs on the client side and implement the corresponding API on the server side.
68
68
69
-
- On the server side, the server implements the service interface and runs a gRPC server to handle client calls. The gRPC infrastructure decodes incoming requests, executes service methods, and encodes service responses.
70
-
- On the client side, the client has a *stub* that implements exactly the same methods as the server. The client can then just call those methods on the local stub, wrapping the parameters in the appropriate protocol buffer message type — gRPC looks after sending the request(s) to the server and returning the server's protocol buffer response(s).
71
-
69
+
- On the server side, the server implements the methods declared by the service and runs a gRPC server to handle client calls. The gRPC infrastructure decodes incoming requests, executes service methods, and encodes service responses.
70
+
- On the client side, the client has a local object known as *stub* (for some languages, the preferred term is *client*) that implements the same methods as the service. The client can then just call those methods on the local object, wrapping the parameters for the call in the appropriate protocol buffer message type - gRPC looks after sending the request(s) to the server and returning the server's protocol buffer response(s).
72
71
73
72
### Synchronous vs. asynchronous
74
73
@@ -84,7 +83,7 @@ Now let's take a closer look at what happens when a gRPC client calls a gRPC ser
84
83
85
84
First let's look at the simplest type of RPC, where the client sends a single request and gets back a single response.
86
85
87
-
- Once the client calls the method on the stub, the server is notified that the RPC has been invoked with the client's [metadata](#metadata) for this call, the method name, and the specified [deadline](#deadlines) if applicable.
86
+
- Once the client calls the method on the stub/client object, the server is notified that the RPC has been invoked with the client's [metadata](#metadata) for this call, the method name, and the specified [deadline](#deadlines) if applicable.
88
87
- The server can then either send back its own initial metadata (which must be sent before any response) straight away, or wait for the client's request message - which happens first is application-specific.
89
88
- Once the server has the client's request message, it does whatever work is necessary to create and populate its response. The response is then returned (if successful) to the client together with status details (status code and optional status message) and optional trailing metadata.
90
89
- If the status is OK, the client then gets the response, which completes the call on the client side.
@@ -136,7 +135,7 @@ TBD
136
135
137
136
### Channels
138
137
139
-
A gRPC channel provides a connection to a gRPC server on a specified host and port and is used when creating a client stub. Clients can specify channel arguments to modify gRPC's default behaviour, such as switching on and off message compression. A channel has state, including <code>connected</code> and <code>idle</code>.
138
+
A gRPC channel provides a connection to a gRPC server on a specified host and port and is used when creating a client stub (or just "client" in some languages). Clients can specify channel arguments to modify gRPC's default behaviour, such as switching on and off message compression. A channel has state, including <code>connected</code> and <code>idle</code>.
140
139
141
140
How gRPC deals with closing down channels is language-dependent. Some languages also permit querying channel state.
@@ -436,8 +437,8 @@ As you can see, a gRPC method can accept only a single protocol buffer message t
436
437
Once we've defined our service, we use the protocol buffer compiler
437
438
`protoc` to generate the special client and server code we need to create
438
439
our application - you
439
-
can generate gRPC code in any gRPC-supported language, although PHP and Objective-C only support creating clients. The generated code contains both stub code for clients to
440
-
use and an abstract interface for servers to implement, both with the method
440
+
can generate gRPC code in any gRPC-supported language, although PHP and Objective-C only support creating clients. The generated code contains both client-side code for clients to
441
+
call into and an abstract interface for servers to implement, both with the method
441
442
defined in our `Greeter` service.
442
443
443
444
(If you didn't install the gRPC plugins and protoc on your system and are just reading along with
@@ -577,9 +578,8 @@ To generate the code, run the following command from the `examples/csharp/hellow
577
578
578
579
Running the appropriate command for your OS regenerates the following files in the Greeter directory:
579
580
580
-
-`Greeter/Helloworld.cs` defines a namespace `Helloworld`
581
-
- This contains all the protocol buffer code to populate, serialize, and retrieve our request and response message types
582
-
-`Greeter/HelloworldGrpc.cs`, provides stub and service classes, including:
581
+
-`Greeter/Helloworld.cs` contains all the protocol buffer code to populate, serialize, and retrieve our request and response message types
582
+
-`Greeter/HelloworldGrpc.cs` provides generated client and server classes, including:
583
583
- an abstract base class `Greeter.GreeterBase` to inherit from when defining RouteGuide service implementations
584
584
- a class `Greeter.GreeterClient` that can be used to access remote RouteGuide instances
585
585
@@ -947,7 +947,7 @@ we'll leave that for the tutorial.
947
947
948
948
First let's look at how we connect to the `Greeter` server. First we need
949
949
to create a gRPC channel, specifying the hostname and port of the server we
950
-
want to connect to. Then we use the channel to construct the stub instance.
950
+
want to connect to. Then we use the channel to construct the client stub instance.
951
951
952
952
953
953
<divclass="tabs">
@@ -1077,7 +1077,7 @@ In PHP, we can do this in a single step using the `GreeterClient` class's constr
1077
1077
Now we can contact the service and obtain a greeting:
1078
1078
1079
1079
1. We construct and fill in a `HelloRequest` to send to the service.
1080
-
2. We call the stub's `SayHello()` RPC with our request and get a populated `HelloReply` if the RPC is successful, from which we can get our greeting.
1080
+
2. We call the client stub's `SayHello()` RPC with our request and get a populated `HelloReply` if the RPC is successful, from which we can get our greeting.
Copy file name to clipboardexpand all lines: docs/tutorials/basic/csharp.md
+5-6
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ service RouteGuide {
52
52
53
53
Then you define `rpc` methods inside your service definition, specifying their request and response types. gRPC lets you define four kinds of service method, all of which are used in the `RouteGuide` service:
54
54
55
-
- A *simple RPC* where the client sends a request to the server using the stub and waits for a response to come back, just like a normal function call.
55
+
- A *simple RPC* where the client sends a request to the server using the client object and waits for a response to come back, just like a normal function call.
56
56
57
57
```protobuf
58
58
// Obtains the feature at a given position.
@@ -123,9 +123,8 @@ To generate the code, the following command should be run from the `examples/csh
123
123
124
124
Running the appropriate command for your OS regenerates the following files in the RouteGuide directory:
125
125
126
-
-`RouteGuide/RouteGuide.cs` defines a namespace `Routeguide`
127
-
- This contains all the protocol buffer code to populate, serialize, and retrieve our request and response message types
128
-
-`RouteGuide/RouteGuideGrpc.cs`, provides stub and service classes
126
+
-`RouteGuide/RouteGuide.cs` contains all the protocol buffer code to populate, serialize, and retrieve our request and response message types
127
+
-`RouteGuide/RouteGuideGrpc.cs` provides generated client and server classes, including:
129
128
- an abstract class `RouteGuide.RouteGuideBase` to inherit from when defining RouteGuide service implementations
130
129
- a class `RouteGuide.RouteGuideClient` that can be used to access remote RouteGuide instances
131
130
@@ -284,9 +283,9 @@ As you can see, we build and start our server using `Grpc.Core.Server` class. To
284
283
285
284
In this section, we'll look at creating a C# client for our `RouteGuide` service. You can see our complete example client code in [examples/csharp/route_guide/RouteGuideClient/Program.cs](https://github.com/grpc/grpc/blob/{{ site.data.config.grpc_release_branch }}/examples/csharp/route_guide/RouteGuideClient/Program.cs).
286
285
287
-
### Creating a stub
286
+
### Creating a client object
288
287
289
-
To call service methods, we first need to create a *stub*.
288
+
To call service methods, we first need to create a client object (also referred to as *stub* for other gRPC languages).
290
289
291
290
First, we need to create a gRPC client channel that will connect to gRPC server. Then, we create an instance of the `RouteGuite.RouteGuideClient` class generated from our .proto, passing the channel as an argument.
0 commit comments