IceRpc.Protobuf 0.3.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
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
#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

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

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.1 198 3/28/2024
0.3.0 228 2/14/2024
0.2.1 189 12/12/2023
0.2.0 118 12/4/2023