IceRpc.Protobuf
0.3.1
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package IceRpc.Protobuf --version 0.3.1
NuGet\Install-Package IceRpc.Protobuf -Version 0.3.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IceRpc.Protobuf" Version="0.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IceRpc.Protobuf --version 0.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: IceRpc.Protobuf, 0.3.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install IceRpc.Protobuf as a Cake Addin #addin nuget:?package=IceRpc.Protobuf&version=0.3.1 // Install IceRpc.Protobuf as a Cake Tool #tool nuget:?package=IceRpc.Protobuf&version=0.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
IceRPC + Protobuf integration
The IceRPC framework allows you to make RPCs with the serialization format and IDL of your choice. It provides full support for both Slice and Protobuf.
The IceRpc.Protobuf NuGet package is part of the IceRPC + Protobuf integration, and includes two .NET assemblies:
- IceRpc.Protobuf.dll is used by the code generated by
protoc-gen-icerpc-csharp
- IceRpc.Protobuf.Generators.dll provides a source generator
Package | Source code | Documentation | Examples | API reference
Sample Code
// Protobuf contract
syntax = "proto3";
package visitor_center;
option csharp_namespace = "VisitorCenter";
// Represents a simple greeter.
service Greeter {
rpc Greet (GreetRequest) returns (GreetResponse);
}
message GreetRequest {
string name = 1;
}
message GreetResponse {
string greeting = 1;
}
// Client application
using IceRpc;
using VisitorCenter;
await using var connection = new ClientConnection(new Uri("icerpc://localhost"));
// GreeterClient is a struct generated by protoc-gen-icerpc-csharp.
var greeter = new GreeterClient(connection);
var request = new GreetRequest { Name = Environment.UserName };
GreetResponse response = await greeter.GreetAsync(request);
Console.WriteLine(response.Greeting);
await connection.ShutdownAsync();
// Server application
using IceRpc;
using VisitorCenter;
// Create a server that dispatches all requests to the same service, an instance of
// Chatbot.
await using var server = new Server(new Chatbot());
server.Listen();
// Wait until the console receives a Ctrl+C.
await CancelKeyPressed;
await server.ShutdownAsync();
// IGreeterService is an interface generated by protoc-gen-icerpc-csharp.
// The [ProtobufService] attribute instructs the Protobuf Service source generator
// (provided by IceRpc.Protobuf.Generators.dll) to implement IDispatcher by directing
// "Greet" requests to the GreetAsync method.
[ProtobufService]
internal partial class Chatbot : IGreeterService
{
public ValueTask<GreetResponse> GreetAsync(
GreetRequest message,
IFeatureCollection features,
CancellationToken cancellationToken)
{
Console.WriteLine($"Dispatching Greet request {{ name = '{message.Name}' }}");
return new(new GreetResponse { Greeting = $"Hello, {message.Name}!" });
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Google.Protobuf (>= 3.26.1)
- IceRpc (>= 0.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on IceRpc.Protobuf:
Repository | Stars |
---|---|
icerpc/icerpc-csharp
A C# RPC framework built for QUIC, with bidirectional streaming, first-class async/await, and Protobuf support.
|