C# SDK for SLIM (Secure Low-Latency Interactive Messaging).
This SDK provides an idiomatic C# API built on top of auto-generated bindings from uniffi-bindgen-cs.
- .NET 8.0 or higher
- Rust toolchain (for building native libraries from source)
- Task (optional, for build automation)
dotnet add package Agntcy.SlimThe NuGet package includes native libraries for all supported platforms. No additional setup required!
using Agntcy.Slim;
Slim.Initialize();
var service = Slim.GetGlobalService();
// ...
Slim.Shutdown();To build the complete SDK, you need artifacts from the Rust bindings build:
# From the root of the repository
cd data-plane/bindings/dotnet
task ci BINDGEN_TARGET=x86_64-unknown-linux-gnu PROFILE=releaseFor development on a single platform:
task generate
task build
task test| Class | Description |
|---|---|
Slim |
Static entry point for initialization, shutdown, and global access |
SlimService |
Service for managing connections and creating apps |
SlimApp |
Application for managing sessions, subscriptions, and routing |
SlimSession |
Session for sending and receiving messages |
SlimName |
Identity in org/namespace/app format |
SlimMessage |
Received message with Payload (bytes) and Text (string) |
SlimSessionConfig |
Session configuration (type, MLS, retries) |
The SDK includes complete working examples demonstrating real-world usage:
- Point-to-Point (
Slim.Examples.PointToPoint): 1:1 messaging with request/reply pattern - Group Messaging (
Slim.Examples.Group): Group sessions with moderator/participant roles - slimrpc (
Slim.Examples.SlimRpc): Protobuf RPC over SLIM (see SLIMRPC.md)
Quick Start:
# Run receiver
dotnet run --project Slim.Examples.PointToPoint -- --local org/alice/v1
# Run sender (in another terminal)
dotnet run --project Slim.Examples.PointToPoint -- \
--local org/bob/v1 --remote org/alice/v1 --message "Hello"slimrpc Example:
Requires a running SLIM server (e.g. cd data-plane && cargo run --bin slim -- --config ./config/base/server-config.yaml).
# Generate proto code (requires buf and protoc-gen-slimrpc-csharp)
task slimrpc:generate-proto
# Run server (in one terminal)
dotnet run --project Slim.Examples.SlimRpc -- --mode server
# Run client (in another terminal)
dotnet run --project Slim.Examples.SlimRpc -- --mode clientSee example source code in Slim.Examples.* projects for full implementation details and command-line options.
The SDK includes smoke tests that don't require a running SLIM server:
task testFor full integration testing with a SLIM server, you would need to:
- Start a SLIM server instance
- Run the example applications to verify functionality
See the Slim.Examples.* projects for working integration examples.
task # List all available tasks
task ci # Run complete CI pipeline: generate, copy runtimes, build, test, pack
task format # Format the C# code using dotnet format
task lint # Check code formatting without applying changes
task generate # Generate C# bindings from artifacts (requires ARTIFACTS_DIR)
task copy:runtimes # Copy runtime libraries from artifacts to runtimes directory
task build # Build .NET solution (expects bindings already generated)
task test # Run smoke tests (no server required)
task pack # Create NuGet package (expects runtimes already copied)
task clean # Clean all build artifactsIf the Rust bindings change, you need to rebuild the Rust library first, then regenerate C# bindings:
task generate| Platform | Architecture | .NET RID | Status |
|---|---|---|---|
| Linux (GNU) | x86_64 | linux-x64 | Supported |
| Linux (GNU) | aarch64 | linux-arm64 | Supported |
| Linux (musl) | x86_64 | linux-musl-x64 | Supported |
| Linux (musl) | aarch64 | linux-musl-arm64 | Supported |
| macOS | x86_64 | osx-x64 | Supported |
| macOS | aarch64 | osx-arm64 | Supported |
| Windows | x86_64 | win-x64 | Supported |
| Windows | aarch64 | win-arm64 | Supported |
The NuGet package includes native libraries for all supported platforms using the standard runtimes/{rid}/native/ structure. When you install the package, .NET automatically selects the correct native library for your platform.
# Install the package
dotnet add package Agntcy.Slim
# Build and run - native library is automatically included
dotnet runThe NuGet package is automatically published when a release tag is pushed (e.g., slim-bindings-v0.1.0). The release workflow:
- Builds native libraries for all supported platforms
- Tests bindings locally with all platform libraries
- Creates a NuGet package with native libraries for all platforms
- Publishes to NuGet.org
Apache-2.0 - See LICENSE for details.
- Go bindings - Go bindings for SLIM
- Python bindings - Python bindings for SLIM
- uniffi-bindgen-cs - C# bindings generator for UniFFI