signalr
Adds real-time update capabilities using SignalR hubs for WebSocket communication between backend and frontend.
Install
mkdir -p .claude/skills/signalr && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18132" && unzip -o skill.zip -d .claude/skills/signalr && rm skill.zipInstalls to .claude/skills/signalr
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Implements real-time WebSocket communication and SignalR hub subscriptions. Use when: Adding real-time updates, broadcasting state changes, implementing client subscriptions, or configuring WebSocket connections in Blazor WASM.Key capabilities
- →Define server-side SignalR hubs
- →Broadcast updates from background services using IHubContext
- →Configure hub connections in Blazor components
- →Add clients to specific groups for targeted broadcasts
- →Handle connection state changes in Blazor UI
How it works
The skill implements real-time WebSocket communication using SignalR, defining server hubs for client connections and allowing background services to broadcast updates to subscribed client groups.
Inputs & outputs
When to use signalr
- →Implementing real-time UI updates
- →Broadcasting system alerts or status changes
- →Setting up WebSocket client subscriptions
About this skill
SignalR Skill
Real-time communication in VanDaemon uses SignalR for WebSocket-based updates between the .NET API and Blazor WASM frontend. The hub at /hubs/telemetry broadcasts tank levels, control states, and alerts to subscribed client groups. Background services poll hardware every 5 seconds and push changes via IHubContext.
Quick Start
Server Hub Definition
// src/Backend/VanDaemon.Api/Hubs/TelemetryHub.cs
public class TelemetryHub : Hub
{
public async Task SubscribeToTanks()
{
await Groups.AddToGroupAsync(Context.ConnectionId, "tanks");
}
public async Task SubscribeToControls()
{
await Groups.AddToGroupAsync(Context.ConnectionId, "controls");
}
public async Task SubscribeToAlerts()
{
await Groups.AddToGroupAsync(Context.ConnectionId, "alerts");
}
}
Broadcasting from Background Service
// Inject IHubContext<TelemetryHub> in background service
await _hubContext.Clients.Group("tanks").SendAsync(
"TankLevelUpdated", tankId, currentLevel, tankName, cancellationToken);
Blazor Client Connection
// In Blazor component
_hubConnection = new HubConnectionBuilder()
.WithUrl($"{_apiBaseUrl}/hubs/telemetry")
.WithAutomaticReconnect()
.Build();
_hubConnection.On<Guid, double, string>("TankLevelUpdated", (id, level, name) =>
{
// Update UI state
InvokeAsync(StateHasChanged);
});
await _hubConnection.StartAsync();
await _hubConnection.InvokeAsync("SubscribeToTanks");
Key Concepts
| Concept | Usage | Example |
|---|---|---|
| Hub | Server endpoint for connections | TelemetryHub : Hub |
| Groups | Broadcast to subset of clients | Groups.AddToGroupAsync(connectionId, "tanks") |
| IHubContext | Broadcast from services | _hubContext.Clients.Group("tanks").SendAsync(...) |
| On<T> | Client-side event handler | _hubConnection.On<Guid, double>("TankLevelUpdated", ...) |
| WithAutomaticReconnect | Resilient connections | .WithAutomaticReconnect() |
Common Patterns
Group-Based Subscriptions
When: Different clients need different update types.
// Client subscribes only to what it needs
await _hubConnection.InvokeAsync("SubscribeToTanks");
await _hubConnection.InvokeAsync("SubscribeToControls");
// Server broadcasts to specific group
await _hubContext.Clients.Group("controls").SendAsync(
"ControlStateChanged", controlId, newState, controlName);
Connection State Handling
When: UI needs to reflect connection status.
_hubConnection.Closed += async (error) =>
{
_isConnected = false;
await InvokeAsync(StateHasChanged);
};
_hubConnection.Reconnected += async (connectionId) =>
{
_isConnected = true;
await _hubConnection.InvokeAsync("SubscribeToTanks");
await InvokeAsync(StateHasChanged);
};
See Also
- patterns - Server and client implementation patterns
- workflows - Setup, testing, and deployment workflows
Related Skills
- See the aspnet-core skill for API and DI configuration
- See the blazor skill for frontend integration patterns
- See the docker skill for nginx WebSocket proxy configuration
When not to use it
- →For traditional HTTP request/response communication
- →When real-time updates are not required
- →When using a different real-time communication technology
Limitations
- →Specific to SignalR technology
- →Examples are tailored for .NET API and Blazor WASM
- →Requires understanding of C# and Blazor development
How it compares
This skill provides specific code templates and patterns for integrating SignalR into .NET API and Blazor WASM applications for real-time communication, offering a structured approach compared to building WebSocket functionality from scratc
Compared to similar skills
signalr side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| signalr (this skill) | 0 | 5mo | No flags | Advanced |
| dotnet-backend-patterns | 7 | 4mo | No flags | Advanced |
| azure-maps-search-dotnet | 2 | 2mo | Review | Intermediate |
| azure-servicebus-dotnet | 3 | 2mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
dotnet-backend-patterns
wshobson
Master C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.
azure-maps-search-dotnet
microsoft
Azure Maps SDK for .NET. Location-based services including geocoding, routing, rendering, geolocation, and weather. Use for address search, directions, map tiles, IP geolocation, and weather data. Triggers: "Azure Maps", "MapsSearchClient", "MapsRoutingClient", "MapsRenderingClient", "geocoding .NET", "route directions", "map tiles", "geolocation".
azure-servicebus-dotnet
microsoft
Azure Service Bus SDK for .NET. Enterprise messaging with queues, topics, subscriptions, and sessions. Use for reliable message delivery, pub/sub patterns, dead letter handling, and background processing. Triggers: "Service Bus", "ServiceBusClient", "ServiceBusSender", "ServiceBusReceiver", "ServiceBusProcessor", "message queue", "pub/sub .NET", "dead letter queue".
m365-agents-dotnet
microsoft
Microsoft 365 Agents SDK for .NET. Build multichannel agents for Teams/M365/Copilot Studio with ASP.NET Core hosting, AgentApplication routing, and MSAL-based auth. Triggers: "Microsoft 365 Agents SDK", "Microsoft.Agents", "AddAgentApplicationOptions", "AgentApplication", "AddAgentAspNetAuthentication", "Copilot Studio client", "IAgentHttpAdapter".
azure-eventgrid-dotnet
microsoft
Azure Event Grid SDK for .NET. Client library for publishing and consuming events with Azure Event Grid. Use for event-driven architectures, pub/sub messaging, CloudEvents, and EventGridEvents. Triggers: "Event Grid", "EventGridPublisherClient", "CloudEvent", "EventGridEvent", "publish events .NET", "event-driven", "pub/sub".
azure-mgmt-mongodbatlas-dotnet
microsoft
Manage MongoDB Atlas Organizations as Azure ARM resources using Azure.ResourceManager.MongoDBAtlas SDK. Use when creating, updating, listing, or deleting MongoDB Atlas organizations through Azure Marketplace integration. This SDK manages the Azure-side organization resource, not Atlas clusters/databases directly.