Skip to content

Commit 4866d3a

Browse files
authored
Various gRPC doc fixes and improvements (#19916)
1 parent 903f644 commit 4866d3a

3 files changed

Lines changed: 18 additions & 15 deletions

File tree

aspnetcore/grpc/comparison.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,23 @@ gRPC is well suited to the following scenarios:
7979
* **Point-to-point real-time communication**: gRPC has excellent support for bi-directional streaming. gRPC services can push messages in real-time without polling.
8080
* **Polyglot environments**: gRPC tooling supports all popular development languages, making gRPC a good choice for multi-language environments.
8181
* **Network constrained environments**: gRPC messages are serialized with Protobuf, a lightweight message format. A gRPC message is always smaller than an equivalent JSON message.
82+
* **Inter-process communication (IPC)**: IPC transports such as Unix domain sockets and named pipes can be used with gRPC to communicate between apps on the same machine. For more information, see <xref:grpc/interprocess>.
8283

8384
## gRPC weaknesses
8485

8586
### Limited browser support
8687

8788
It's impossible to directly call a gRPC service from a browser today. gRPC heavily uses HTTP/2 features and no browser provides the level of control required over web requests to support a gRPC client. For example, browsers do not allow a caller to require that HTTP/2 be used, or provide access to underlying HTTP/2 frames.
8889

89-
[gRPC-Web](https://grpc.io/docs/tutorials/basic/web.html) is an additional technology from the gRPC team that provides limited gRPC support in the browser. gRPC-Web consists of two parts: a JavaScript client that supports all modern browsers, and a gRPC-Web proxy on the server. The gRPC-Web client calls the proxy and the proxy will forward on the gRPC requests to the gRPC server.
90+
There are two common approaches to bring gRPC to browser apps:
9091

91-
Not all of gRPC's features are supported by gRPC-Web. Client and bi-directional streaming isn't supported, and there is limited support for server streaming.
92+
* [gRPC-Web](https://grpc.io/docs/tutorials/basic/web.html) is an additional technology from the gRPC team that provides gRPC support in the browser. gRPC-Web allows browser apps to benefit from the high-performance and low network usage of gRPC. Not all of gRPC's features are supported by gRPC-Web. Client and bi-directional streaming isn't supported, and there is limited support for server streaming.
9293

93-
> [!TIP]
94-
> .NET Core has support for gRPC-Web. Visit <xref:grpc/browser> for more information.
94+
.NET Core has support for gRPC-Web. For more information, see <xref:grpc/browser>.
95+
96+
* RESTful JSON Web APIs can be automatically created from gRPC services by annotating the *.proto* file with [HTTP metadata](https://cloud.google.com/service-infrastructure/docs/service-management/reference/rpc/google.api#google.api.HttpRule). This allows an app to support both gRPC and JSON web APIs, without duplicating effort of building separate services for both.
97+
98+
.NET Core has experimental support for creating JSON web APIs from gRPC services. For more information, see <xref:grpc/httpapi>.
9599

96100
### Not human readable
97101

@@ -107,7 +111,6 @@ Other frameworks are recommended over gRPC in the following scenarios:
107111

108112
* **Browser accessible APIs**: gRPC isn't fully supported in the browser. gRPC-Web can offer browser support, but it has limitations and introduces a server proxy.
109113
* **Broadcast real-time communication**: gRPC supports real-time communication via streaming, but the concept of broadcasting a message out to registered connections doesn't exist. For example in a chat room scenario where new chat messages should be sent to all clients in the chat room, each gRPC call is required to individually stream new chat messages to the client. [SignalR](xref:signalr/introduction) is a useful framework for this scenario. SignalR has the concept of persistent connections and built-in support for broadcasting messages.
110-
* **Inter-process communication**: A process must host an HTTP/2 server to accept incoming gRPC calls. For Windows, inter-process communication [pipes](/dotnet/standard/io/pipe-operations) is a fast, lightweight method of communication.
111114

112115
## Additional resources
113116

aspnetcore/grpc/interprocess.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static GrpcChannel CreateChannel()
9393
var connectionFactory = new UnixDomainSocketConnectionFactory(udsEndPoint);
9494
var socketsHttpHandler = new SocketsHttpHandler
9595
{
96-
ConnectionFactory = connectionFactory.ConnectAsync
96+
ConnectCallback = connectionFactory.ConnectAsync
9797
};
9898

9999
return GrpcChannel.ForAddress("http://localhost", new GrpcChannelOptions

aspnetcore/grpc/test-tools.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Test gRPC services with gRPCurl in ASP.NET Core
33
author: jamesnk
44
description: Learn how to test services with gRPC tools. gRPCurl a command-line tool for interacting with gRPC services. gRPCui is an interactive web UI.
5-
monikerRange: '>= aspnetcore-3.1'
5+
monikerRange: '>= aspnetcore-3.0'
66
ms.author: jamesnk
77
ms.date: 08/09/2020
88
no-loc: ["ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR]
@@ -65,16 +65,16 @@ When gRPC reflection is set up:
6565

6666
The `-help` argument explains `grpcurl` command-line options:
6767

68-
```powershell
69-
> grpcurl.exe -help
68+
```console
69+
$ grpcurl -help
7070
```
7171

7272
### Discover services
7373

7474
Use the `describe` verb to view the services defined by the server:
7575

76-
```powershell
77-
> grpcurl.exe localhost:5001 describe
76+
```console
77+
$ grpcurl localhost:5001 describe
7878
greet.Greeter is a service:
7979
service Greeter {
8080
rpc SayHello ( .greet.HelloRequest ) returns ( .greet.HelloReply );
@@ -96,7 +96,7 @@ The preceding example:
9696
Combine `describe` with a service, method, or message name to view its detail:
9797

9898
```powershell
99-
> grpcurl.exe localhost:5001 describe greet.HelloRequest
99+
$ grpcurl localhost:5001 describe greet.HelloRequest
100100
greet.HelloRequest is a message:
101101
message HelloRequest {
102102
string name = 1;
@@ -107,8 +107,8 @@ message HelloRequest {
107107

108108
Call a gRPC service by specifying a service and method name along with a JSON argument that represents the request message. The JSON is converted into Protobuf and sent to the service.
109109

110-
```powershell
111-
> grpcurl.exe -d '{ \"name\": \"World\" }' localhost:5001 greet.Greeter/SayHello
110+
```console
111+
$ grpcurl -d '{ \"name\": \"World\" }' localhost:5001 greet.Greeter/SayHello
112112
{
113113
"message": "Hello World"
114114
}
@@ -131,7 +131,7 @@ For information about downloading and installing `grpcui`, see the [gRPCui GitHu
131131
Run `grpcui` with the server address to interact with as an argument:
132132

133133
```powershell
134-
> grpcui.exe localhost:5001
134+
$ grpcui localhost:5001
135135
gRPC Web UI available at http://127.0.0.1:55038/
136136
```
137137

0 commit comments

Comments
 (0)