Flynk.Net.Services.Transmit.Grpc 1.3.1

Prefix Reserved
dotnet add package Flynk.Net.Services.Transmit.Grpc --version 1.3.1
                    
NuGet\Install-Package Flynk.Net.Services.Transmit.Grpc -Version 1.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="Flynk.Net.Services.Transmit.Grpc" Version="1.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Flynk.Net.Services.Transmit.Grpc" Version="1.3.1" />
                    
Directory.Packages.props
<PackageReference Include="Flynk.Net.Services.Transmit.Grpc" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Flynk.Net.Services.Transmit.Grpc --version 1.3.1
                    
#r "nuget: Flynk.Net.Services.Transmit.Grpc, 1.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.
#:package Flynk.Net.Services.Transmit.Grpc@1.3.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Flynk.Net.Services.Transmit.Grpc&version=1.3.1
                    
Install as a Cake Addin
#tool nuget:?package=Flynk.Net.Services.Transmit.Grpc&version=1.3.1
                    
Install as a Cake Tool

Flynk.Net.Services.Transmit.Grpc

A high-performance gRPC-based messaging library for .NET that provides typed RPC communication with routing, serialization, and bidirectional streaming.

Packages

Package Description NuGet
Flynk.Net.Services.Transmit.Grpc.Common Shared infrastructure (proto types, RpcHandlerRegistry, utilities). Auto-included with Client/Server. NuGet
Flynk.Net.Services.Transmit.Grpc.Client Lightweight client library. No ASP.NET Core dependencies. NuGet
Flynk.Net.Services.Transmit.Grpc.Server Server hosting library with ASP.NET Core integration. NuGet

Package Dependencies

    Common (1.3.0)
      ↑         ↑
      |         |
  Client     Server
  (1.3.0)    (1.3.0)
      ↖       ↗
        Test

Both Client and Server depend on Common. All three packages should use matching versions.

Features

  • Typed request/response handling with automatic JSON serialization
  • Route-based message handlers
  • Bidirectional streaming communication
  • Built-in reconnection with configurable settings
  • Service discovery via Info endpoint
  • Port validation and conflict detection
  • Security controls for client-to-client communication

Quick Start

Server Setup

dotnet new web -n MyServer
cd MyServer
dotnet add package Flynk.Net.Services.Transmit.Grpc.Server

Program.cs:

using Flynk.Net.Services.Transmit.Grpc.Server;
using Flynk.Net.Services.Transmit.Grpc.Server.Extensions;
using Flynk.Net.Services.Transmit.Grpc.Client;

var builder = WebApplication.CreateBuilder(args);
builder.AddTransmissionService(grpcPort: 5001);

var app = builder.Build();
app.MapTransmissionService();

// Handle requests sent to server
RpcHandlerRegistry.RegisterServerHandler(async (request) =>
{
    Console.WriteLine($"Received: {request.MessageType}");
    return new TransmissionResponse
    {
        Id = Guid.NewGuid().ToString(),
        CorrelationId = request.Id,
        Success = true,
        StatusCode = 200,
        Timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds()
    };
}, serverId: "server");

app.Run();

Client Setup

dotnet new console -n MyClient
cd MyClient
dotnet add package Flynk.Net.Services.Transmit.Grpc.Client

Program.cs:

using Flynk.Net.Services.Transmit.Grpc.Client;
using Microsoft.Extensions.Logging;

var loggerFactory = LoggerFactory.Create(b => b.AddConsole());
var logger = loggerFactory.CreateLogger<RpcClient>();

using var client = new RpcClient(address: "http://localhost:5001", id: "my-client", logger: logger);

// Send request to server
var response = await client.RequestAsync<PingRequest, PingResponse>(
    route: "ping",
    request: new PingRequest { Message = "Hello!" },
    timeout: TimeSpan.FromSeconds(10)  // Optional timeout
);

Console.WriteLine($"Success: {response.IsOK}");

public record PingRequest(string Message);
public record PingResponse(string Reply);

Security

By default, clients can only communicate with the server. To enable client-to-client messaging (if your application requires it):

// On server - enable peer-to-peer messaging
RpcHandlerRegistry.EnableClientToClientCommunication();

Documentation

Architecture

┌─────────────────┐         ┌─────────────────┐
│   RpcClient     │────────▶│TransmissionClient│
│  (High-level)   │         │   (Low-level)    │
└─────────────────┘         └─────────────────┘
        │                            │
        ▼                            ▼
┌─────────────────┐         ┌─────────────────┐
│ Route Handlers  │         │  gRPC Service   │
└─────────────────┘         └─────────────────┘

Key Classes

Client Package

  • RpcClient - High-level client with typed routing
  • TransmissionClient - Low-level gRPC client
  • RpcClientSettings - Connection configuration
  • RpcHandlerRegistry - Handler registration
  • Response<T> - Response wrapper

Server Package

  • TransmissionServiceImpl - gRPC service implementation
  • WebApplicationBuilderExtensions - Host configuration
  • ServiceCollectionExtensions - DI registration
  • PortUtility - Port management utilities

Route Naming Convention

Use hierarchical dot notation:

"user.create"
"user.update"
"order.process"
"payment.authorize"

Response Handling

// In handlers
return Response<T>.OK(payload);
return Response<T>.OK(payload, "Success message");
return Response<T>.FAILED("Error description");

// Checking responses
if (response.IsOK)
{
    var data = response.Payload;
}
else
{
    Console.WriteLine(response.Message);
}

Configuration Options

Client Settings

var settings = new RpcClientSettings
{
    EnableReconnection = true,
    ReconnectionDelaySeconds = 5,
    MaxReconnectionAttempts = 10  // -1 for unlimited
};

Server Options

builder.AddTransmissionService(options =>
{
    options.HttpPort = 5000;        // REST API
    options.GrpcPort = 5001;        // gRPC
    options.Host = "0.0.0.0";       // All interfaces
    options.ValidatePorts = true;
});

Troubleshooting

Port Conflicts

using Flynk.Net.Services.Transmit.Grpc.Utilities;

if (!PortUtility.IsPortAvailable(5001))
{
    Console.WriteLine(PortUtility.CreatePortConflictMessage(5001));
}

Handler Not Found

  • Ensure RegisterServerHandler() is called before app.Run()
  • Verify route names match exactly (case-sensitive)
  • For client-to-client: ensure EnableClientToClientCommunication() is called

Connection Issues

Enable debug logging:

builder.Logging.SetMinimumLevel(LogLevel.Debug);

License

This software is licensed under the Flynk Freeware License.

Support

For issues or questions, please contact the development team or create an issue in the repository.

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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
1.3.1 166 1/13/2026