Naravel.Broadcasting 0.2.0

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

Naravel.Broadcasting

NuGet Downloads .NET 10 License: MIT

Typed real-time broadcasting over SignalR for Naravel: IBroadcastable events, channel authorization rules, signalr/log/null drivers and a test fake, built on Naravel.Foundation and Naravel.Events.

Fact Detail
Install dotnet add package Naravel.Broadcasting
Targets .NET 10
Needs Naravel.Foundation, Naravel.Cache and Naravel.Events, which NuGet installs with it, and ASP.NET Core (the Microsoft.AspNetCore.App shared framework)
Drivers signalr (the default), log and null, chosen by Broadcasting:Default

What you get

  • Events that name their channels. An IBroadcastable event returns its Channels(), and AddBroadcastOn<T>() opts each event type in.
  • Who may join is a registered rule. Channels.Authorize("private-orders.{id}", ...) decides which connections may join a channel.
  • Presence channels tell their members who else is there, like Laravel's Echo.join().
  • Swappable drivers. Switch in configuration, or add your own at run time with BroadcastManager.Extend.
  • A test fake. BroadcastFake is an IBroadcaster that records the message the real one would send.

Quick start

using Naravel.Broadcasting;
using Naravel.Events;   // AddNaravelEvents and IEventDispatcher come from Naravel.Events

builder.Services.AddNaravelEvents();
builder.Services.AddNaravelBroadcasting(
    builder.Configuration,
    o => o.Channels.Authorize("private-orders.{id}", (user, id) => user.FindFirst("order")?.Value == id));   // the "order" claim is your own
builder.Services.AddBroadcastOn<OrderShipped>();   // Naravel.Events dispatches by exact type, so opt each event type in

app.MapNaravelBroadcasting("/hubs/broadcast");

app.MapPost("/orders/{id}/ship", async (string id, IEventDispatcher events, CancellationToken ct) =>
{
    await events.DispatchAsync(new OrderShipped(id), ct);   // the listener broadcasts before this returns
    return Results.Accepted();
});

public sealed record OrderShipped(string OrderId) : IBroadcastable
{
    public IEnumerable<string> Channels() => [$"private-orders.{OrderId}"];
}

A client calls the hub method Subscribe with a channel name and listens under the event's BroadcastAs() name, which is the type name by default. A channel that starts with private- or presence- is refused unless the connection is authenticated and a registered rule allows it, so the host also needs ASP.NET Core authentication that SignalR connections can use; any other channel name is public.

Delivery is inline and at most once: it finishes before BroadcastAsync returns, nothing is replayed, and a client that is offline misses the message. With several instances, configure a SignalR backplane yourself. Broadcasting:Default is signalr; named drivers go under Broadcasting:Stores:<name>:Driver (signalr, log or null). Presence lists live in the application's cache, so they are shared between instances only when AddNaravelCache (from Naravel.Cache) is configured with a Redis or Memcached default store; otherwise they are per process. In tests, register BroadcastFake from Naravel.Broadcasting.Testing in place of the real IBroadcaster.

Learn more

Part of Naravel: Laravel's names, .NET's type system. All Naravel packages share one version.

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.2.0 93 11/13/2026
0.1.1 102 11/2/2026
0.1.0 107 11/1/2026