LoguxNET.Server.Core
1.0.0
dotnet add package LoguxNET.Server.Core --version 1.0.0
NuGet\Install-Package LoguxNET.Server.Core -Version 1.0.0
<PackageReference Include="LoguxNET.Server.Core" Version="1.0.0" />
<PackageVersion Include="LoguxNET.Server.Core" Version="1.0.0" />
<PackageReference Include="LoguxNET.Server.Core" />
paket add LoguxNET.Server.Core --version 1.0.0
#r "nuget: LoguxNET.Server.Core, 1.0.0"
#:package LoguxNET.Server.Core@1.0.0
#addin nuget:?package=LoguxNET.Server.Core&version=1.0.0
#tool nuget:?package=LoguxNET.Server.Core&version=1.0.0
LoguxNET.Server.Core
Managed wrapper around the clogux C engine. Provides a safe, idiomatic C# API over the native P/Invoke layer.
Target Framework
net10.0
Structure
LoguxNET.Server.Core/
├── LoguxServer.cs Main engine wrapper (IDisposable)
├── LoguxServerConfig.cs Server configuration
├── LoguxException.cs Exception type wrapping LoguxError codes
└── LoguxOutboundMessage.cs Outbound message (connection + data)
LoguxServer
The central class. Not thread-safe — all calls must happen from a single thread, matching the threading contract of the underlying C library.
Creation
using var server = new LoguxServer(new LoguxServerConfig
{
ServerNodeId = "server:myapp:1",
Subprotocol = 1,
PingIntervalMs = 5000,
TimeoutMs = 10000,
MaxConnections = 0, // unlimited
});
Callback Handlers
Set before the main loop:
| Property | Signature | Purpose |
|---|---|---|
AuthHandler |
Func<LoguxHandle, string, string, bool> |
Authentication: (conn, nodeId, token) → allow? |
AccessHandler |
Func<LoguxHandle, string, bool> |
Action authorization: (conn, actionJson) → allow? |
ProcessHandler |
Action<LoguxHandle, string> |
Post-broadcast side-effects (DB writes, etc.) |
ResendHandler |
Func<LoguxHandle, string, string?> |
Channel routing: return comma-separated channels |
ChannelAccessHandler |
Func<LoguxHandle, string, bool> |
Subscribe authorization: (conn, channel) → allow? |
ChannelLoadHandler |
Func<LoguxHandle, string, int> |
Load initial channel state, return count |
ErrorHandler |
Action<LoguxError, LoguxHandle, string?> |
Internal engine errors |
Main Loop Methods
| Method | Description |
|---|---|
AcceptConnection(string remoteAddr) |
Register a new connection, returns LoguxHandle |
FeedData(LoguxHandle, ReadOnlySpan<byte>) |
Feed raw WebSocket frame data |
CloseConnection(LoguxHandle) |
Close a connection |
Tick() |
Advance the engine (pings, timeouts, internal processing) |
PollOutbound() |
Get pending outbound messages |
GetStats() |
Get server statistics snapshot |
Shutdown() |
Graceful shutdown — sends close frames |
Dispose() |
Destroy the native engine instance |
Example: Low-level Usage
server.AuthHandler = (conn, nodeId, token) => token == "secret";
server.AccessHandler = (conn, json) => true;
while (running)
{
LoguxHandle h = server.AcceptConnection(remoteAddr);
server.FeedData(h, frameBytes);
server.Tick();
foreach (var msg in server.PollOutbound())
Send(msg.Connection, msg.Data.Span);
}
server.Shutdown();
foreach (var msg in server.PollOutbound()) { /* flush */ }
LoguxServerConfig
| Property | Type | Default | Description |
|---|---|---|---|
ServerNodeId |
string |
required | Unique server node ID |
Subprotocol |
int |
1 | App subprotocol version |
MinSubprotocol |
int |
1 | Minimum accepted version |
PageSize |
uint |
0 (4096) | SlotMap page size |
PingIntervalMs |
uint |
0 (5000) | Ping interval, ms |
TimeoutMs |
uint |
0 (10000) | Connection timeout, ms |
MaxConnections |
uint |
0 (unlimited) | Max concurrent connections |
MaxFeedSize |
uint |
0 (64 KiB) | Max inbound message size |
LoguxException
Thrown when a native call returns a non-zero LoguxError code. Contains the ErrorCode property for programmatic handling.
LoguxOutboundMessage
public readonly struct LoguxOutboundMessage
{
public LoguxHandle Connection { get; }
public ReadOnlyMemory<byte> Data { get; }
}
Outbound JSON bytes paired with the target connection handle. Polled via LoguxServer.PollOutbound().
| 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. |
-
net10.0
- LoguxNET.Server.Interop (>= 1.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on LoguxNET.Server.Core:
| Package | Downloads |
|---|---|
|
LoguxNET.Server.AspNet
ASP.NET Core integration for the Logux Protocol v5 server (DI, WebSocket middleware, BackgroundService). |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 116 | 4/5/2026 |