Tharga.Communication
SignalR-based client/server communication framework for .NET with built-in message handler patterns for request-response and fire-and-forget messaging, plus a pluggable API key validator and subscription-based messaging. Built for .NET 8 / 9.
Packages
| Package | What it does |
|---|---|
| Tharga.Communication | SignalR transport, message handlers, subscriptions, and pluggable API key validation. |
| Tharga.Communication.Mcp | Exposes Communication runtime data (connected clients, active subscriptions, registered handlers) as MCP resources. Plugs into Tharga.Mcp. |
Quick start
dotnet add package Tharga.Communication
// Server
builder.AddThargaCommunicationServer(options =>
{
options.RegisterClientStateService<MyClientStateService>();
options.RegisterClientRepository<MemoryClientRepository<ClientConnectionInfo>, ClientConnectionInfo>();
});
app.UseThargaCommunicationServer();
// Client
builder.AddThargaCommunicationClient();
See Getting started for the full walkthrough.
What's in the box
- Messaging —
PostAsync(fire-and-forget) andSendMessage(request-response), routed to handlers via DI. See Messaging. - Subscriptions — server signals clients when consumers are active, with type-based and data-based granularity. Clients can skip work when nobody is watching. See Subscriptions.
- Authentication — pluggable
IApiKeyValidatorwith a default keys-array implementation; consumers can swap in Platform-backed lookups. Client identity (ClientType,ClientMachine) can be overridden. See Authentication.
Repo
github.com/Tharga/Communication — source, issues, releases.