SDK Overview

Read time 3 minutes Package: Nalix.SDK
On this page

Namespaces: Nalix.SDK, Nalix.SDK.Transport, Nalix.SDK.Transport.Extensions, Nalix.SDK.Extensions, Nalix.SDK.Options
Assembly: Nalix.SDK

Nalix.SDK is the client-side transport and protocol package for Nalix. It provides concrete client sessions (TcpSession, UdpSession, WebSocketSession), an abstract/interface session contract (TransportSession / ITransportSession), X25519 handshakes with TOFU/pinning and Proof-of-Work solving, 0-RTT session resumption, HKDF key rotation (RekeyAsync), correlated request/response helpers (RequestAsync / TryRequestAsync), streaming (StreamAsync / RequestWithStreamAsync), and source-generated RPC client proxies (CreateRpcClient<T>).

Source Mapping

  • src/Nalix.SDK/Transport/ (ITransportSession.cs, TransportSession.cs, SessionState.cs, TcpSession.cs, UdpSession.cs, WebSocketSession.cs)
  • src/Nalix.SDK/Transport/Extensions/ (HandshakeExtensions.cs, ResumeExtensions.cs, CipherExtensions.cs, RekeyExtensions.cs, RequestExtensions.cs, StreamExtensions.cs, HeaderStreamExtensions.cs, ChannelExtensions.cs, ObservableExtensions.cs, RpcExtensions.cs, PingExtensions.cs, DisconnectExtensions.cs, TimeSyncExtensions.cs, ControlExtensions.cs, TransportSessionSubscriptions.cs)
  • src/Nalix.SDK/Extensions/ (ProtocolStringExtensions.cs, SubscriptionExtensions.cs)
  • src/Nalix.SDK/Options/ (TransportOptions.cs, WebSocketTransportOptions.cs, RequestOptions.cs, RequestOutcome.cs)
  • src/Nalix.SDK/IThreadDispatcher.cs, src/Nalix.SDK/InlineDispatcher.cs, src/Nalix.SDK/TimeSyncCalculator.cs

Client Architecture

Architecture Diagram
flowchart TD
    subgraph App["Client Application"]
        Req["RequestAsync / TryRequestAsync / CreateRpcClient<T>"]
        Stream["StreamAsync / RequestWithStreamAsync / SubscribeChannel"]
        Sub["On<TPacket> / AsObservable<TPacket>"]
    end

    subgraph Session["ITransportSession / TransportSession"]
        State["SessionState (Secret, SessionToken, EncryptionEnabled, LocalPort)"]
        Sup["ReconnectSupervisor + KeepAlive Monitor"]
        TCP["TcpSession"]
        UDP["UdpSession"]
        WS["WebSocketSession"]
    end

    subgraph Framers["Internal Framers + FramePipeline"]
        TF["TcpFrameSender / TcpFrameReader"]
        UF["UdpFrameSender / UdpFrameReader"]
        WF["WsFrameSender / WsFrameReader"]
    end

    App --> Session
    TCP --> TF
    UDP --> UF
    WS --> WF

API Reference Map

Transport Sessions

Security, Control & Request Extensions

Utilities & Options

Quick Start Example

using Nalix.SDK.Options;
using Nalix.SDK.Transport;
using Nalix.SDK.Transport.Extensions;

TransportOptions options = new()
{
    Address = "127.0.0.1",
    Port = 57206,
    AutoReconnectEnabled = true,
    KeepAliveIntervalMillis = 15_000
};

using TcpSession client = new(options);

// 1. Connect and perform authenticated X25519 handshake
await client.ConnectAsync();
await client.HandshakeAsync();

// 2. Send a correlated request and await the response
LoginResponse reply = await client.RequestAsync<LoginResponse>(
    new LoginRequest { Username = "Alice" },
    RequestOptions.Default.WithTimeout(3_000).WithEncrypt());

// 3. Gracefully disconnect
await client.DisconnectGracefullyAsync();