Grpc.Net.Client.Web
2.46.0
Prefix Reserved
Install-Package Grpc.Net.Client.Web -Version 2.46.0
dotnet add package Grpc.Net.Client.Web --version 2.46.0
<PackageReference Include="Grpc.Net.Client.Web" Version="2.46.0" />
paket add Grpc.Net.Client.Web --version 2.46.0
#r "nuget: Grpc.Net.Client.Web, 2.46.0"
// Install Grpc.Net.Client.Web as a Cake Addin
#addin nuget:?package=Grpc.Net.Client.Web&version=2.46.0
// Install Grpc.Net.Client.Web as a Cake Tool
#tool nuget:?package=Grpc.Net.Client.Web&version=2.46.0
Grpc.Net.Client.Web
The .NET gRPC client can be configured to make gRPC-Web calls. This is useful for Blazor WebAssembly apps, which are hosted in the browser and have the same HTTP limitations of JavaScript code. Calling gRPC-Web with a .NET client is the same as HTTP/2 gRPC. The only modification is how the channel is created.
To use gRPC-Web:
- Add a reference to the Grpc.Net.Client.Web package.
- Ensure the reference to Grpc.Net.Client package is 2.29.0 or greater.
- Configure the channel to use the
GrpcWebHandler
:
var channel = GrpcChannel.ForAddress("https://localhost:5001", new GrpcChannelOptions
{
HttpHandler = new GrpcWebHandler(new HttpClientHandler())
});
var client = new Greeter.GreeterClient(channel);
var response = await client.SayHelloAsync(new HelloRequest { Name = ".NET" });
The preceding code:
- Configures a channel to use gRPC-Web.
- Creates a client and makes a call using the channel.
GrpcWebHandler
has the following configuration options:
- InnerHandler: The underlying
HttpMessageHandler
that makes the gRPC HTTP request, for example,HttpClientHandler
. - GrpcWebMode: An enumeration type that specifies whether the gRPC HTTP request
Content-Type
isapplication/grpc-web
orapplication/grpc-web-text
.GrpcWebMode.GrpcWeb
configures content to be sent without encoding. Default value.GrpcWebMode.GrpcWebText
configures content to be base64 encoded. Required for server streaming calls in browsers.
- HttpVersion: HTTP protocol
Version
used to setHttpRequestMessage.Version
on the underlying gRPC HTTP request. gRPC-Web doesn't require a specific version and doesn't override the default unless specified.
Links
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETStandard 2.0
- System.Memory (>= 4.5.3)
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages (14)
Showing the top 5 NuGet packages that depend on Grpc.Net.Client.Web:
Package | Downloads |
---|---|
M5x.Grpc
Package Description |
|
CRZ
Package Description |
|
SynapIot.Api.SDK
Package Description |
|
Havit.Blazor.Grpc.Client
HAVIT Blazor stack - gRPC Support - client-side |
|
Unihealth.DataLake.Api.Client
Package Description |
GitHub repositories (5)
Showing the top 5 popular GitHub repositories that depend on Grpc.Net.Client.Web:
Repository | Stars |
---|---|
dodyg/practical-aspnetcore
Practical samples of ASP.NET Core 2.1, 2.2, 3.1, 5.0, 6.0 and 7.0 projects you can use. Readme contains explanations on all projects.
|
|
grpc/grpc-dotnet
gRPC for .NET
|
|
microsoft/RockPaperScissorsLizardSpock
Rock, Paper, Scissors, Lizard, Spock - Sample Application
|
|
SteveSandersonMS/BlazeOrbital
Sample application for Blazor WebAssembly on .NET 6
|
|
telerik/blazor-ui
A collection of examples related to Telerik UI for Blazor Components: https://www.telerik.com/blazor-ui
|
Version | Downloads | Last updated |
---|---|---|
2.46.0 | 4,183 | 5/13/2022 |
2.46.0-pre1 | 635 | 4/28/2022 |
2.45.0 | 16,418 | 4/19/2022 |
2.45.0-pre1 | 204 | 4/7/2022 |
2.44.0 | 20,645 | 3/17/2022 |
2.44.0-pre1 | 558 | 3/9/2022 |
2.43.0 | 24,804 | 2/25/2022 |
2.43.0-pre1 | 3,226 | 1/28/2022 |
2.42.0 | 46,225 | 1/19/2022 |
2.42.0-pre1 | 899 | 12/30/2021 |
2.41.0 | 60,079 | 12/7/2021 |
2.41.0-pre1 | 18,091 | 11/12/2021 |
2.40.0 | 132,713 | 10/5/2021 |
2.40.0-pre1 | 462 | 9/9/2021 |
2.39.0 | 65,071 | 8/18/2021 |
2.39.0-pre1 | 10,725 | 8/6/2021 |
2.38.0 | 128,620 | 6/11/2021 |
2.38.0-pre1 | 384 | 6/4/2021 |
2.37.0 | 79,793 | 4/20/2021 |
2.37.0-pre1 | 232 | 4/14/2021 |
2.36.0 | 34,718 | 3/17/2021 |
2.36.0-pre1 | 514 | 3/9/2021 |
2.35.0 | 34,831 | 2/4/2021 |
2.35.0-pre1 | 191 | 1/26/2021 |
2.34.0 | 79,280 | 12/11/2020 |
2.34.0-pre1 | 321 | 12/1/2020 |
2.33.1 | 18,356 | 10/28/2020 |
2.33.1-pre1 | 293 | 10/22/2020 |
2.32.0 | 7,303 | 10/5/2020 |
2.32.0-pre1 | 776 | 9/8/2020 |
2.31.0 | 13,716 | 8/14/2020 |
2.31.0-pre2 | 276 | 8/3/2020 |
2.30.0 | 16,601 | 7/16/2020 |
2.30.0-pre1 | 841 | 6/17/2020 |
2.29.0 | 14,060 | 5/27/2020 |
2.29.0-pre1 | 727 | 5/15/2020 |
2.28.0-pre2 | 6,673 | 3/11/2020 |
2.28.0-pre1 | 6,373 | 3/3/2020 |
2.27.0-pre1 | 6,009 | 1/24/2020 |