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
<PackageReference Include="Flynk.Net.Services.Transmit.Grpc" Version="1.3.1" />
<PackageVersion Include="Flynk.Net.Services.Transmit.Grpc" Version="1.3.1" />
<PackageReference Include="Flynk.Net.Services.Transmit.Grpc" />
paket add Flynk.Net.Services.Transmit.Grpc --version 1.3.1
#r "nuget: Flynk.Net.Services.Transmit.Grpc, 1.3.1"
#:package Flynk.Net.Services.Transmit.Grpc@1.3.1
#addin nuget:?package=Flynk.Net.Services.Transmit.Grpc&version=1.3.1
#tool nuget:?package=Flynk.Net.Services.Transmit.Grpc&version=1.3.1
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 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 routingTransmissionClient- Low-level gRPC clientRpcClientSettings- Connection configurationRpcHandlerRegistry- Handler registrationResponse<T>- Response wrapper
Server Package
TransmissionServiceImpl- gRPC service implementationWebApplicationBuilderExtensions- Host configurationServiceCollectionExtensions- DI registrationPortUtility- 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 beforeapp.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 | 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. 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. |
-
net8.0
- Flynk.Common.Utils (>= 6.2.2)
- Google.Protobuf (>= 3.32.1)
- Grpc.AspNetCore (>= 2.71.0)
- Grpc.Net.Client (>= 2.71.0)
- Microsoft.EntityFrameworkCore (>= 8.0.11)
- Microsoft.EntityFrameworkCore.Abstractions (>= 8.0.11)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.11)
- MongoDB.Bson (>= 3.5.0)
- System.Text.Json (>= 8.0.11)
- System.Threading.Channels (>= 8.0.11)
-
net9.0
- Flynk.Common.Utils (>= 6.2.2)
- Google.Protobuf (>= 3.32.1)
- Grpc.AspNetCore (>= 2.71.0)
- Grpc.Net.Client (>= 2.71.0)
- Microsoft.EntityFrameworkCore (>= 9.0.9)
- Microsoft.EntityFrameworkCore.Abstractions (>= 9.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.9)
- MongoDB.Bson (>= 3.5.0)
- System.Text.Json (>= 9.0.9)
- System.Threading.Channels (>= 9.0.9)
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 |