LoguxNET.Server.AspNet
1.0.0
dotnet add package LoguxNET.Server.AspNet --version 1.0.0
NuGet\Install-Package LoguxNET.Server.AspNet -Version 1.0.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="LoguxNET.Server.AspNet" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LoguxNET.Server.AspNet" Version="1.0.0" />
<PackageReference Include="LoguxNET.Server.AspNet" />
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 LoguxNET.Server.AspNet --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LoguxNET.Server.AspNet, 1.0.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 LoguxNET.Server.AspNet@1.0.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=LoguxNET.Server.AspNet&version=1.0.0
#tool nuget:?package=LoguxNET.Server.AspNet&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
LoguxNET.Server.AspNet
ASP.NET Core integration for the Logux server. Provides DI registration, WebSocket middleware, and a BackgroundService engine loop.
Target Framework
net10.0
Structure
LoguxNET.Server.AspNet/
├── LoguxOptions.cs Configuration (server + ASP.NET)
├── ILoguxAuthHandler.cs Authentication interface
├── ILoguxActionHandler.cs Action authorize / process / resend interface
├── ILoguxChannelHandler.cs Channel authorize / load interface
├── LoguxConnectionManager.cs Command queue + Handle↔WebSocket registry
├── LoguxEngineService.cs BackgroundService engine loop
├── LoguxWebSocketMiddleware.cs WebSocket upgrade + read loop
├── EngineCommand.cs Internal command types
├── LoguxServiceCollectionExtensions.cs AddLogux() extension
└── LoguxApplicationBuilderExtensions.cs UseLogux() extension
Setup
1. Register Services
builder.Services.AddLogux(opts =>
{
opts.ServerNodeId = "server:myapp:1";
opts.Path = "/logux"; // WebSocket endpoint
opts.TickIntervalMs = 10; // engine tick interval
opts.PingIntervalMs = 5000;
opts.TimeoutMs = 10000;
opts.MaxConnections = 0; // unlimited
});
2. Implement Handlers
Register all three as singletons in DI:
builder.Services.AddSingleton<ILoguxAuthHandler, MyAuthHandler>();
builder.Services.AddSingleton<ILoguxActionHandler, MyActionHandler>();
builder.Services.AddSingleton<ILoguxChannelHandler, MyChannelHandler>();
3. Add Middleware
app.UseWebSockets();
app.UseLogux();
Handler Interfaces
ILoguxAuthHandler
public interface ILoguxAuthHandler
{
bool Authenticate(LoguxHandle connection, string nodeId, string token);
}
Called on every connect message. Return true to accept, false to reject.
ILoguxActionHandler
public interface ILoguxActionHandler
{
bool Authorize(LoguxHandle connection, string actionJson);
void Process(LoguxHandle connection, string actionJson);
string? Resend(LoguxHandle connection, string actionJson);
}
| Method | Purpose |
|---|---|
Authorize |
Access control — return false to deny (sends logux/undo) |
Process |
Side-effects after broadcast (DB writes, cache invalidation) |
Resend |
Channel routing — return comma-separated channel names or null |
ILoguxChannelHandler
public interface ILoguxChannelHandler
{
bool Authorize(LoguxHandle connection, string channel);
int Load(LoguxHandle connection, string channel);
}
| Method | Purpose |
|---|---|
Authorize |
Subscribe access control |
Load |
Push initial channel state to the client, return action count |
LoguxOptions
| Property | Type | Default | Description |
|---|---|---|---|
ServerNodeId |
string |
"server:default:1" |
Unique server node ID |
Subprotocol |
int |
1 | App subprotocol version |
MinSubprotocol |
int |
1 | Minimum accepted version |
MaxConnections |
uint |
0 (unlimited) | Max concurrent connections |
MaxFeedSize |
uint |
0 (64 KiB) | Max inbound message size |
PingIntervalMs |
uint |
0 (5000) | Ping interval, ms |
TimeoutMs |
uint |
0 (10000) | Connection timeout, ms |
PageSize |
uint |
0 (4096) | SlotMap page size |
Path |
string |
"/logux" |
WebSocket endpoint path |
TickIntervalMs |
int |
10 | Engine tick interval, ms |
Architecture
ASP.NET ThreadPool Engine Thread (BackgroundService)
────────────────── ────────────────────────────────
WS Middleware 1 ──┐ ┌──► logux_connection_accept()
WS Middleware 2 ──┤── Channel<Command> ──► ├──► logux_feed_data()
WS Middleware N ──┘ ├──► logux_connection_close()
├──► logux_tick()
└──► logux_poll_outbound()
│
┌─────────────────────────────┘
▼
ws.SendAsync() (routed by LoguxHandle)
- WebSocket middleware upgrades connections at the configured
Path, reads frames, and enqueuesEngineCommanditems into aChannel<T>. - LoguxEngineService (BackgroundService) drains the command channel, calls the clogux engine, and routes outbound messages back to WebSocket connections via
LoguxConnectionManager. WaitToReadAsyncwithTickIntervalMstimeout ensures low latency on new data while still processing pings/timeouts periodically.
Full Example
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddLogux(opts =>
{
opts.ServerNodeId = "server:chat:1";
opts.Path = "/logux";
});
builder.Services.AddSingleton<ILoguxAuthHandler, ChatAuthHandler>();
builder.Services.AddSingleton<ILoguxActionHandler, ChatActionHandler>();
builder.Services.AddSingleton<ILoguxChannelHandler, ChatChannelHandler>();
var app = builder.Build();
app.UseWebSockets();
app.UseLogux();
app.Run();
// --- Handlers ---
class ChatAuthHandler : ILoguxAuthHandler
{
public bool Authenticate(LoguxHandle conn, string nodeId, string token)
=> token == "secret";
}
class ChatActionHandler : ILoguxActionHandler
{
public bool Authorize(LoguxHandle conn, string json) => true;
public void Process(LoguxHandle conn, string json) { /* save to DB */ }
public string? Resend(LoguxHandle conn, string json) => "chat";
}
class ChatChannelHandler : ILoguxChannelHandler
{
public bool Authorize(LoguxHandle conn, string channel) => true;
public int Load(LoguxHandle conn, string channel) => 0;
}
| Product | Versions 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.
-
net10.0
- LoguxNET.Server.Core (>= 1.0.0)
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 |
|---|---|---|
| 1.0.0 | 109 | 4/5/2026 |