UmbralSocket.Net 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package UmbralSocket.Net --version 1.1.0
                    
NuGet\Install-Package UmbralSocket.Net -Version 1.1.0
                    
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="UmbralSocket.Net" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UmbralSocket.Net" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="UmbralSocket.Net" />
                    
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 UmbralSocket.Net --version 1.1.0
                    
#r "nuget: UmbralSocket.Net, 1.1.0"
                    
#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 UmbralSocket.Net@1.1.0
                    
#: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=UmbralSocket.Net&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=UmbralSocket.Net&version=1.1.0
                    
Install as a Cake Tool

UmbralSocket.Net

Uma biblioteca binária de comunicação ultraleve e de altíssimo desempenho via Unix Sockets ou Named Pipes para backends .NET 9 AOT. Inspirada em umbral-socket do Rust.

Exemplo rápido

using System.Buffers;
using System.Text;
using UmbralSocket.Net.Unix;

var server = new UnixUmbralSocketServer();
server.RegisterHandler(0x01, payload =>
{
    // Converter ReadOnlySequence<byte> para string
    var text = Encoding.UTF8.GetString(UmbralSocket.Net.SequenceExtensions.ToArray(payload));
    return ValueTask.FromResult(Encoding.UTF8.GetBytes($"SAVE:{text}"));
});

var cts = new CancellationTokenSource();
_ = server.StartAsync(cts.Token);

var client = new UnixUmbralSocketClient();
var response = await client.SendAsync(0x01, Encoding.UTF8.GetBytes("hello"));
Console.WriteLine(Encoding.UTF8.GetString(response)); // SAVE:hello
cts.Cancel();

🚀 Exemplos completos

Confira os projetos de exemplo completos em samples/ que demonstram:

  • Unix Sockets e Named Pipes
  • Múltiplos handlers por opcode
  • Serialização JSON com AOT
  • Benchmarks de performance
  • Diferentes cenários de uso
  • Cross-platform compatibility

🎮 Executar os exemplos

cd samples/UmbralSocket.Net.Sample

# Modo interativo (menu)
dotnet run

# Demos específicos
dotnet run namedpipe   # Named Pipe demo (Windows)
dotnet run benchmark   # Performance benchmark  
dotnet run json        # JSON serialization demo

📋 Ver detalhes completos: SAMPLES.md

Licença

Este projeto está licenciado sob a Licença MIT.

CI/CD e Publicação

Este projeto usa GitHub Actions para automação de CI/CD com as seguintes funcionalidades:

  • Build e Teste Automático: Executado em todos os PRs e pushes
  • Publicação no NuGet: Automática quando uma tag de versão é criada
  • Publicação no GitHub Packages: Backup da publicação

Configuração de Secrets

Para que a publicação funcione, configure os seguintes secrets no GitHub:

  1. NUGET_API_KEY: Sua chave de API do NuGet.org
  2. GITHUB_TOKEN: Automaticamente fornecido pelo GitHub

Como fazer um release

  1. Atualize a versão no arquivo .csproj
  2. Crie uma tag: git tag v1.0.0
  3. Faça push da tag: git push origin v1.0.0
  4. O GitHub Actions automaticamente publicará no NuGet

Atribuição

Este projeto foi inspirado pelo umbral-socket de alan-venv, que está licenciado sob as licenças Apache-2.0 e MIT. Embora esta seja uma implementação independente para .NET, reconhecemos a inspiração e o design conceitual do projeto original em Rust.

Product Compatible and additional computed target framework versions.
.NET 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.
  • net9.0

    • No dependencies.

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.2.0 217 8/6/2025
1.1.0 222 8/6/2025
1.0.0 220 8/5/2025

v1.1.0: Adicionado SequenceExtensions.ToArray, exemplos atualizados, documentação aprimorada e melhorias de compatibilidade AOT. Veja CHANGELOG.md para detalhes.