Faactory.Canonical.Client 0.1.0

dotnet add package Faactory.Canonical.Client --version 0.1.0
                    
NuGet\Install-Package Faactory.Canonical.Client -Version 0.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="Faactory.Canonical.Client" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Faactory.Canonical.Client" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Faactory.Canonical.Client" />
                    
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 Faactory.Canonical.Client --version 0.1.0
                    
#r "nuget: Faactory.Canonical.Client, 0.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 Faactory.Canonical.Client@0.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=Faactory.Canonical.Client&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Faactory.Canonical.Client&version=0.1.0
                    
Install as a Cake Tool

Canonical Client

Client for the built-in Canonical WebSocket protocol.

await using var client = await CanonicalClient.ConnectAsync(
    new Uri( "wss://example.com/canonical" ) );

CanonicalResponse response = await client.ExecuteAsync(
    "apps.deploy",
    payload );

CanonicalResponse<DeployResponse> typedResponse =
    await client.ExecuteAsync<DeployResponse>(
        "apps.deploy",
        new DeployRequest( "app" ) );

await foreach ( CanonicalEvent evt in client.ReadAllAsync( "apps.watch", payload ) )
{
    // Handle the event.
}

await using Stream stream = await client.StreamAsync(
    "apps.logs",
    payload );

The raw API exposes payloads as JsonElement. The generic ExecuteAsync<T>() overload uses JsonSerializerOptions.Web for request and response payloads. Canonical errors throw CanonicalClientException.

ExecuteAsync() accepts responses only. ReadAllAsync() accepts events and ends at the final response. StreamAsync() exposes text and binary output through one Stream.

To configure ClientWebSocketOptions, supply a repeatable connection factory:

await using var client = await CanonicalClient.ConnectAsync(
    async cancellationToken =>
    {
        var socket = new ClientWebSocket();

        try
        {
            socket.Options.SetRequestHeader( "Authorization", token );

            await socket.ConnectAsync( uri, cancellationToken );

            return socket;
        }
        catch
        {
            socket.Dispose();

            throw;
        }
    } );

The URI and factory overloads reconnect for later requests after a connection fails. In-flight requests fail and are never replayed. Reconnection uses capped exponential delay configured through CanonicalClientOptions.

Passing one open WebSocket to the constructor disables reconnection because the client cannot replace that socket. The client always takes ownership of its sockets.

CanonicalClientOptions limits active requests, message size, unread events, and unread stream bytes. It also controls reconnection attempts and delay. A slow consumer fails only its request; it does not block the shared connection.

Transport keepalive is configured through ClientWebSocketOptions in the connection factory. There is no application-level idle timeout because a valid request may remain silent.

Cancelling a call stops the local wait. The client drains that request until its final response because the protocol has no cancellation message.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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
0.1.0 104 8/27/2026