PouryaKit.Realtime 0.1.0-preview.2

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

PouryaKit.Realtime

NuGet .NET 10 License: MIT

PouryaKit.Realtime

Server-sent events pushed from Notification Handlers. A handler publishes a plain record on a Channel, and the push is a PostgreSQL notification written on the delivery's own transaction, so every instance of the Host hears it only when that delivery commits. Each instance passes it on to its connected clients of the delivery's tenant that listen on the Channel.

Install

dotnet add package PouryaKit.Realtime --prerelease

When to use it

  • Browsers should see a change as soon as it commits: a new product, a finished job, a message in an inbox.
  • You map a Module's SSE endpoint and decide which Channels an Actor may listen on.

It builds on PouryaKit.Web and on the Unit of Work of PouryaKit.Persistence.EFCore, and its pushes come from the Notification Handlers of PouryaKit.Messaging.

Quick start

Register the listener in the Host, over the database the Modules store in:

builder.Services.AddPouryaKitRealtime(connectionName: "app");

Map the Module's SSE endpoint and the rule that admits an Actor to a Channel:

internal sealed class NewProductsRealtime : IEndpoint
{
    public void Map(IEndpointRouteBuilder routes) =>
        routes.MapPouryaKitRealtime("/events", (_, channel) => channel == NewProduct.Channel);
}

Push from a Notification Handler, as the Proving Sample does:

internal sealed class AnnounceNewProductNotificationHandler(
    INewProductAnnouncer announcer,
    IRealtimePublisher realtime
) : INotificationHandler<ProductCreatedDomainEvent>
{
    public async Task<Result> Handle(
        ProductCreatedDomainEvent domainEvent,
        CancellationToken cancellationToken
    )
    {
        await announcer.AnnounceAsync(
            new NewProductAnnouncement(domainEvent.ProductId.Value, domainEvent.Name),
            cancellationToken
        );
        return await realtime.PublishAsync(
            NewProduct.Channel,
            new NewProduct(domainEvent.ProductId.Value, domainEvent.Name),
            cancellationToken
        );
    }
}

What you get

  • A push that reaches clients only once its delivery commits, so a rollback pushes nothing.
  • Every instance of the Host hears it, through the database the Modules already use.
  • Pushes held to the delivery's tenant, on Channels the endpoint's rule admits.
  • No SignalR and no second channel to the client.

Delivery to clients is at most once. A client receives a push only while it is connected, and nothing is stored or replayed: when it connects again it reads its state through a query.

Keep each push a small fact or a reference; the client reads the rest.

Learn more

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-preview.2 67 11/1/2026
0.1.0-preview.1 70 10/31/2026
0.1.0-preview.0.28 66 10/26/2026