Hona.Blazor.GrpcWeb.DevTools
1.0.1
dotnet add package Hona.Blazor.GrpcWeb.DevTools --version 1.0.1
NuGet\Install-Package Hona.Blazor.GrpcWeb.DevTools -Version 1.0.1
<PackageReference Include="Hona.Blazor.GrpcWeb.DevTools" Version="1.0.1" />
paket add Hona.Blazor.GrpcWeb.DevTools --version 1.0.1
#r "nuget: Hona.Blazor.GrpcWeb.DevTools, 1.0.1"
// Install Hona.Blazor.GrpcWeb.DevTools as a Cake Addin #addin nuget:?package=Hona.Blazor.GrpcWeb.DevTools&version=1.0.1 // Install Hona.Blazor.GrpcWeb.DevTools as a Cake Tool #tool nuget:?package=Hona.Blazor.GrpcWeb.DevTools&version=1.0.1
Introduction
gRPC-Web is becoming increasingly popular in the .NET world and, of course, in Blazor.
But not only the technology, also the tooling for gRPC-Web has an important role. For some time now, there has been a Chrome browser extension for the gRPC-Web Developer Tools.
I have made it my task to make this incredibly useful tool also usable for Blazor 😃
Getting started
Prerequisites
You need .NET 7.0 or newer to use this library.
Download .NET 7 Download .NET 8
You also need the gRPC-Web Developer Tools Chrome Extsion
Install gRPC-Web Developer Tools
Platform support
The gRPC-Web Developer Tools only available for Google Chrome and Microsoft Edge browser.
Installation
You can install the package via NuGet with the Package Manager in your IDE or alternatively using the command line:
dotnet add package PatrickJahr.Blazor.GrpcWebDevTools
Usage
The package can be used in Blazor WebAssembly projects.
Enable gRPC-Web Developer Tools on your project
At first you have to register a GrpcChannel
in your ServiceCollection
like this:
builder.Services.AddScoped(services =>
{
var channel = GrpcChannel.ForAddress(backendUrl,
new GrpcChannelOptions
{
HttpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler())
});
return channel;
});
Then you can add your gRPC-Services with the extension method AddGrpcService<T>
:
builder.Services.AddGrpcService<IConferencesService>();
builder.Services.AddGrpcService<ITimeService>();
To enable the gRPC-Web Developer Tools on your project you have two opportunities:
- First you can enable them via the AppSettings:
{
"GrpcDevToolsEnabled": true
}
- Or you can enable them with the extension method
EnableGrpcWebDevTools
in yourProgram.cs
:
builder.Services.EnableGrpcWebDevTools();
License and Note
BSD-3-Clause.
This is a technical showcase, not an official PatrickJahr product.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Grpc.Core (>= 2.46.6)
- Grpc.Net.Client (>= 2.61.0)
- Microsoft.JSInterop (>= 7.0.17)
- protobuf-net.Grpc.ClientFactory (>= 1.1.1)
-
net8.0
- Grpc.Core (>= 2.46.6)
- Grpc.Net.Client (>= 2.61.0)
- Microsoft.JSInterop (>= 8.0.3)
- protobuf-net.Grpc.ClientFactory (>= 1.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.1 | 682 | 9/5/2024 |