IceRpc.Protobuf 0.4.1

Prefix Reserved
dotnet add package IceRpc.Protobuf --version 0.4.1                
NuGet\Install-Package IceRpc.Protobuf -Version 0.4.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.4.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IceRpc.Protobuf --version 0.4.1                
#r "nuget: IceRpc.Protobuf, 0.4.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.4.1

// Install IceRpc.Protobuf as a Cake Tool
#tool nuget:?package=IceRpc.Protobuf&version=0.4.1                

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:

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 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.

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.
Version Downloads Last updated
0.4.1 87 11/15/2024
0.4.0.1 161 9/17/2024
0.4.0 101 9/16/2024
0.3.1 247 3/28/2024
0.3.0 259 2/14/2024
0.2.1 229 12/12/2023
0.2.0 142 12/4/2023