Lumen.SSE 1.0.4

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

πŸ”ŒLumen β€” SSE for ASP.NET Core

NuGet Downloads NuGet Version

A lightweight, configurable Server-Sent Events (SSE) library for ASP.NET Core.
Easily add real-time, uni-directional server-to-client messaging without WebSockets.


✨ Features

  • βœ… Simple integration with minimal APIs
  • 🧩 Middleware-based connection handling
  • 🧠 Supports multiple clients & devices per user
  • πŸ”„ Built-in ping/keep-alive
  • πŸ”§ Fully configurable endpoints and connection logic
  • πŸ“¦ .NET 6/7/8 compatible

πŸ“¦ Installation

Install via NuGet:

dotnet add package Lumen.SSE

πŸš€ Usage

1. Configure services

To customize global SSE behavior (ping interval, connection limits, etc.), see
πŸ‘‰ AddSse Configuration Options

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSse();
2. Configure middleware

To customize middleware-level behavior such as connection path, user/device IDs, etc., see
πŸ‘‰ UseSse Configuration Options

var app = builder.Build();
app.UseSse();
3. Send events

To send events in different ways and configure middleware part, see πŸ‘‰ Sending Events with ISsePublisher

app.MapPost("/send-message", async (
    Message message,
    ISsePublisher sse)
    => await sse.New()
        .SetEvent("new_message")
        .SetData(message)
        .SendToAllClientsAsync());

πŸ“‘ Client-Side (JavaScript)

const sseUrl = `https://localhost:7287/sse/connection`;
const eventSource = new EventSource(sseUrl);

eventSource.onopen = () => {
    console.log("βœ… Connected to SSE server");
};

eventSource.addEventListener("new_message", (event) => {
    const parsedData = JSON.parse(event.data);
    console.log("πŸ“¨ New Message:", parsedData);
});

eventSource.onerror = (err) => {
    console.error("🚨 SSE connection error:", err);
};

πŸ” SSE vs WebSockets

Feature SSE (Server-Sent Events) WebSockets
Direction Server ➜ Client (one-way) Bi-directional (Client ⬄ Server)
Protocol HTTP/1.1 (works with HTTP/2 partial support) Custom over TCP (upgrades from HTTP)
Browser Support Widely supported, except for IE/old Edge Widely supported
Complexity Simple to implement More complex (stateful, needs connection management)
Reconnection Built-in automatic reconnection Manual reconnection logic
Use Case Notifications, live feeds, updates Chat apps, multiplayer games, complex interaction
Proxy-Friendly Yes Sometimes blocked by firewalls/proxies

🟒 Use SSE when:

  • You only need server-to-client updates
  • You want a simple, scalable, and HTTP-friendly solution

🟑 Use WebSockets when:

  • You need real-time two-way communication
  • The client should also be able to push events to the server

πŸ’‘ Why choose Lumen (SSE)?

  • Zero dependencies
  • High performance for broadcasting updates
  • Great for lightweight, read-only real-time applications

πŸ’¬ Questions? Feedback?

Feel free to open an issue or contact the maintainer.


Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.