dotnet-signalr

Implement and review SignalR hubs, streaming, reconnection, and scaling patterns in ASP.NET Core applications.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-signalr-zhenpenglai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-signalr
Source: https://github.com/zhenpengLai/myuseskill/tree/main/dotnet-signalr
Command: npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-signalr-zhenpenglai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building real-time features like chat, notifications, and live updates in ASP.NET Core requires correct handling of hub lifetimes, reconnection, group membership, authentication, and multi-server scale-out, which are easy to get wrong. ## Core Features & Use Cases - Hub Implementation Patterns: Strongly-typed hubs, thin hub methods with service delegation, custom request objects for backward-compatible API evolution, and group-based targeted messaging. - Connection & Client Guidance: Automatic reconnection with retry delays, group rejoining after reconnect, JWT authentication over WebSockets, and lifecycle event handling for both JavaScript and .NET clients. - Scale-Out & Anti-Patterns: Redis backplane and Azure SignalR Service configuration, plus a detailed catalog of mistakes such as storing state in hub properties, unawaited sends, and missing input validation. - Use Case: When adding a live notification feed to an ASP.NET Core app deployed across multiple servers, use this Skill to design the hub contract, configure JWT auth and a Redis backplane, and verify reconnection behavior. ## Quick Start Ask the assistant to implement a strongly-typed SignalR chat hub with automatic reconnection and Redis backplane scaling in your ASP.NET Core project.

Frequently Asked Questions about dotnet-signalr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a SignalR hub in ASP.NET Core?▼

Define a client interface, inherit from Hub<TClient> for compile-time safety, and register the hub with app.MapHub. Keep hub methods thin by delegating business logic to injected services and use custom request objects so the API can evolve without breaking clients.

How to handle SignalR reconnection and group membership?▼

Use withAutomaticReconnect on the client with retry delays, then rejoin groups in the onreconnected handler because group membership is tied to the old connection ID. On the server, persist group membership in a store and restore it in OnConnectedAsync.

Does SignalR work across multiple servers?▼

SignalR requires a backplane for multi-server deployments, otherwise messages only reach clients connected to the same server. Configure the Redis backplane with AddStackExchangeRedis or use Azure SignalR Service, and use sticky sessions when self-hosting.

SignalR vs gRPC for real-time communication, which should I use?▼

Use SignalR for broadcast-style, connection-oriented fan-out to many clients such as chat or live dashboards. Use gRPC for high-performance point-to-point RPC and bulk data transfer; do not force gRPC into hub-style fan-out scenarios.

Why is state stored in SignalR hub properties lost between calls?▼

Hub instances are transient and created per method invocation, so instance fields reset on every call. Store shared state in IMemoryCache, a database, or a distributed store, and use Context.Items for per-connection state.

How do I send SignalR messages from outside a hub?▼

Inject IHubContext<THub, TClient> into your service and call Clients.All, Clients.User, or Clients.Group from it. Never instantiate a hub directly, since that bypasses the SignalR infrastructure and leaves context and clients null.