signalr-integration
Installation
SKILL.md
Rationale
Real-time communication enhances user experience with instant updates, notifications, and collaborative features. SignalR provides a robust framework for bidirectional communication between server and clients. Without proper patterns, applications can suffer from connection leaks, scalability issues, and security vulnerabilities. These patterns provide production-ready approaches to SignalR in Razor Pages applications.
Patterns
Pattern 1: Hub Structure and Organization
Organize hubs by domain with proper authentication and group management.
// Base hub with common functionality
public abstract class AuthenticatedHub : Hub
{
protected string? UserId => Context.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
protected bool IsAuthenticated => !string.IsNullOrEmpty(UserId);