Asterisk.Sdk.Push 1.15.3

Suggested Alternatives

Verbara.Sdk.Push

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

Asterisk.Sdk.Push

Real-time push primitives for .NET. AOT-safe, host-agnostic, MIT licensed.

What it does

  • Typed, in-memory event bus (IPushEventBus) backed by a bounded System.Threading.Channels.Channel<T> with configurable backpressure.
  • Delivery filter (IEventDeliveryFilter) that enforces tenant isolation and optional per-user targeting before an event reaches a subscriber.
  • Subscription registry (ISubscriptionRegistry) for tracking active subscribers per tenant with automatic cleanup on disposal.
  • First-class diagnostics via System.Diagnostics.Metrics (meter name Asterisk.Sdk.Push).

No ASP.NET Core dependency. No reflection. Trim-safe.

Install

dotnet add package Asterisk.Sdk.Push

Quick start

using Asterisk.Sdk.Push.Bus;
using Asterisk.Sdk.Push.Delivery;
using Asterisk.Sdk.Push.Events;
using Asterisk.Sdk.Push.Hosting;
using Asterisk.Sdk.Push.Subscriptions;
using Microsoft.Extensions.DependencyInjection;

// 1) Define a concrete event
public sealed record ConversationAssigned : PushEvent
{
    public required string ConversationId { get; init; }
    public override string EventType => "conversation.assigned";
}

// 2) Register services
var services = new ServiceCollection();
services.AddLogging();
services.AddAsteriskPush(options =>
{
    options.BufferCapacity = 512;
    options.BackpressureStrategy = BackpressureStrategy.DropOldest;
});

using var sp = services.BuildServiceProvider();
var bus      = sp.GetRequiredService<IPushEventBus>();
var filter   = sp.GetRequiredService<IEventDeliveryFilter>();
var registry = sp.GetRequiredService<ISubscriptionRegistry>();

// 3) Register a subscriber and subscribe to a typed stream
var subscriber = new SubscriberContext(
    TenantId:    "tenant-1",
    UserId:      "user-42",
    Roles:       new HashSet<string> { "agent" },
    Permissions: new HashSet<string> { "conversation:read" });

using var _registration = registry.Register(subscriber);

using var subscription = bus.OfType<ConversationAssigned>().Subscribe(evt =>
{
    if (filter.IsDeliverableToSubscriber(evt, subscriber))
    {
        Console.WriteLine($"{evt.EventType}: {evt.ConversationId}");
    }
});

// 4) Publish
await bus.PublishAsync(new ConversationAssigned
{
    ConversationId = "c-123",
    Metadata = new PushEventMetadata(
        TenantId:      "tenant-1",
        UserId:        "user-42",
        OccurredAt:    DateTimeOffset.UtcNow,
        CorrelationId: null),
});

Contract

PushEventBusOptions

Setting Default Description
BufferCapacity 256 Max in-flight events before the backpressure strategy kicks in. Must be >= 1.
BackpressureStrategy DropOldest Behavior when the buffer is full.

BackpressureStrategy

  • DropOldest (default) — evict the oldest buffered event to make room for the new one. Favors freshness; appropriate for live UI streams where stale events are worthless.
  • DropNewest — refuse to enqueue the new event, preserving the buffered backlog. Favors FIFO ordering.
  • Block — await buffer space. Use only when publishers can tolerate backpressure (batch pipelines, not hot request paths).

Dropped events increment asterisk.push.events.dropped with a reason="buffer_full" tag.

Observability

The package exposes a System.Diagnostics.Metrics.Meter named Asterisk.Sdk.Push with the following instruments:

Instrument Kind Description
asterisk.push.events.published Counter<long> Events accepted by PublishAsync.
asterisk.push.events.delivered Counter<long> Events dispatched to at least one observer.
asterisk.push.events.dropped Counter<long> Events discarded (tag: reason=buffer_full\|filter_rejected).
asterisk.push.subscribers.active ObservableGauge<int> Current active subscriptions (bound via PushMetrics.BindActiveSubscribersGauge).

Wire into OpenTelemetry with meterProvider.AddMeter("Asterisk.Sdk.Push").

AOT

This package is Native AOT compatible. The shipping build verifies zero trim warnings (IL2026 / IL2070 / IL2075 / IL3050 / ...) via the repo's AotCanary publish (tools/verify-aot.sh). No reflection, no DataAnnotations runtime validator, no dynamic code.

Relation with Asterisk.Sdk.Pro.Push

This package provides in-memory primitives suitable for single-node hosts. For NATS-backed multi-node fan-out in the MIT surface, see Asterisk.Sdk.Push.Nats (available since v1.12). For cluster-wide subscription routing over durable backplanes (Redis / Postgres LISTEN/NOTIFY), advanced authorization, and enterprise observability, see Asterisk.Sdk.Pro.Push — both build on top of this package's abstractions, so the contract is forward-compatible.

Licensed under the MIT License.

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 (3)

Showing the top 3 NuGet packages that depend on Asterisk.Sdk.Push:

Package Downloads
Asterisk.Sdk.Push.AspNetCore

Asterisk.Sdk.Push.AspNetCore - SSE push delivery endpoints for ASP.NET Core. Maps IPushEventBus events to Server-Sent Events with topic filtering and JWT authorization.

Asterisk.Sdk.Push.Webhooks

Asterisk.Sdk.Push.Webhooks - outbound HTTP webhook delivery for Asterisk.Sdk.Push. Consumes events from the Push bus, matches against WebhookSubscription topic patterns, POSTs with HMAC-SHA256 signature and exponential retry/backoff. AOT-safe.

Asterisk.Sdk.Push.Nats

Asterisk.Sdk.Push.Nats - publishes Push bus events to a NATS subject hierarchy that mirrors the Push topic tree (asterisk.sdk.**). AOT-safe.

GitHub repositories

This package is not used by any popular GitHub repositories.