Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Signalr

ASecurity

ASP.NET Core SignalR covering .NET 8, 9, and 10. Deep expertise in hubs, transport negotiation, groups, streaming, authentication, Azure SignalR Service, Redis backplane, MessagePack, and scaling patterns. Use for \"SignalR\", \"hub\", \"HubContext\", \"SignalR group\", \"SignalR streaming\", \"Azure SignalR Service\", \"SignalR backplane\", \"SignalR Redis\", \"SignalR authentication\", \"SignalR reconnect\", \"MessagePack\", \"SignalR scale-out\", \"strongly typed hub\", \"IHubContext\", \"...

4 stars
0 votes
0 copies
0 views
Added 9/24/2026
developmentjavascriptgojavac#azureapidatabasebackendsecurityperformance

Works with

cliapi

Security Analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned 9/24/2026

$npx -y skills add chrishuffman5/domain-expert --skill signalr --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Signalr?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Signalr
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/chrishuffman5-signalr/badge)](https://www.skillsdirectory.com/skills/chrishuffman5-signalr)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: signalr
description: "ASP.NET Core SignalR covering .NET 8, 9, and 10. Deep expertise in hubs, transport negotiation, groups, streaming, authentication, Azure SignalR Service, Redis backplane, MessagePack, and scaling patterns. Use for \"SignalR\", \"hub\", \"HubContext\", \"SignalR group\", \"SignalR streaming\", \"Azure SignalR Service\", \"SignalR backplane\", \"SignalR Redis\", \"SignalR authentication\", \"SignalR reconnect\", \"MessagePack\", \"SignalR scale-out\", \"strongly typed hub\", \"IHubContext\", \"SignalR .NET\", \"Hub filter\". Do NOT use for general ASP.NET Core framework questions unrelated to real-time hubs (middleware, minimal APIs, EF Core) — use the `aspnet-core` skill in the `backend` plugin for that."
license: MIT
---

# SignalR (.NET 8-10)

This skill covers ASP.NET Core SignalR, Microsoft's real-time communication library for .NET. Covers .NET 8, 9, and 10 (preview). It has deep knowledge of:

- Hub model: methods, strongly-typed hubs, client targeting, lifecycle
- Transport negotiation: WebSocket > SSE > Long Polling
- Groups, user targeting, and connection management
- Streaming: `IAsyncEnumerable<T>`, `ChannelReader<T>` (server and client)
- Authentication: JWT, cookies, custom user ID providers
- Scale-out: Redis backplane, Azure SignalR Service
- Hub protocols: JSON (default), MessagePack (binary)
- Hub filters (`IHubFilter`) for cross-cutting concerns
- `IHubContext<T>` for sending messages from outside hubs

## How to Approach Tasks

1. **Classify** the request:
   - **Architecture / hub design** -- Load `references/architecture.md` for hub model, transports, protocols, lifecycle, streaming
   - **Performance / scaling** -- Load `references/best-practices.md` for Azure SignalR Service, Redis backplane, reconnection, security
   - **Troubleshooting** -- Load `references/diagnostics.md` for connection failures, transport issues, auth problems, scaling issues
   - **Cross-technology comparison** -- Read the `overview` skill for SignalR vs Socket.IO, WebSocket, SSE

2. **Gather context** -- .NET version, transport in use, scaling approach (single server vs Azure SignalR Service vs Redis), authentication method

3. **Analyze** -- Apply SignalR-specific reasoning: hub lifecycle (transient), group persistence, transport fallback behavior, backplane latency.

4. **Recommend** -- Provide C# code, JavaScript client code, and Azure configuration.

## Core Architecture

### Hub Model

Hubs are the central abstraction. Server defines methods callable by clients and vice versa. Hubs are **transient** -- do NOT store state in hub properties.

```csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSignalR();
var app = builder.Build();
app.MapHub<ChatHub>("/chathub");
```

### Transport Negotiation

Priority: WebSocket (preferred) > SSE > Long Polling. Skip negotiation for performance:
```csharp
options.SkipNegotiation = true;
options.Transports = HttpTransportType.WebSockets;
```

### Client Targeting

`Clients.All`, `Clients.Caller`, `Clients.Others`, `Clients.Client(id)`, `Clients.Group(name)`, `Clients.User(userId)`, `Clients.OthersInGroup(name)`.

### Hub Protocols

JSON (built-in, default) and MessagePack (~30-40% smaller payloads, faster parsing). Add MessagePack: `builder.Services.AddSignalR().AddMessagePackProtocol()`.

### IHubContext for External Messages

```csharp
public class NotificationService(IHubContext<ChatHub> hubContext) : BackgroundService {
    protected override async Task ExecuteAsync(CancellationToken ct) {
        await hubContext.Clients.All.SendAsync("Notification", "Heartbeat", ct);
    }
}
```

## Anti-Patterns

1. **Storing state in hub properties** -- Hubs are transient. Each method call creates a new instance. Use external state (Redis, database).
2. **Not re-joining groups after reconnect** -- Groups are cleaned up on disconnect. Persist group membership and re-join in `OnConnectedAsync`.
3. **Calling `RemoveFromGroupAsync` in `OnDisconnectedAsync`** -- Groups auto-cleanup. No need to remove.
4. **Enabling `DetailedErrors` in production** -- Exposes internal error details to clients. Only use in development.
5. **Ignoring token expiry on long-lived connections** -- WebSocket connections remain authenticated after token expires. Use `CloseOnAuthenticationExpiration: true` or validate per-message.
6. **Not using `IHubContext` from outside hubs** -- Never instantiate a hub directly. Use DI-injected `IHubContext<T>`.
7. **Blocking hub methods** -- Hub methods block the connection pipeline. Use `async/await` and return quickly.
8. **Strongly typed hubs with Native AOT** -- `Hub<T>` is not compatible with Native AOT (.NET 9+).

## Reference Files

- `references/architecture.md` -- Hub model, transports, protocols, lifecycle, streaming, groups, strongly-typed hubs, hub filters, client results
- `references/best-practices.md` -- Authentication (JWT, cookies), Azure SignalR Service, Redis backplane, reconnection, MessagePack, performance, security
- `references/diagnostics.md` -- Connection failures, transport negotiation issues, auth problems, scaling issues, streaming errors, group management

## Cross-References

- `overview` skill -- SignalR vs Socket.IO, WebSocket, SSE comparisons
- `aspnet-core` skill (in the `backend` plugin) -- ASP.NET Core framework context

Attribution

chrishuffman5chrishuffman5
View sourceSee grades on GitHubMore from chrishuffman5 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Clean Code

Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments

304955 votes

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

286712 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Writing Plans

Use when you have a spec or requirements for a multi-step task, before touching code

2927051 votes
View all in development →