Index · Quick recall Q&A
1 min readQuick recall Q&A
SignalR when you need automatic fallbacks, connection management, groups for broadcasting, and easy horizontal scaling with Redis. Raw WebSockets for maximum performance with custom protocols where you control both endpoints.
Use a backplane like Redis or Azure SignalR Service. The backplane distributes messages across server instances so any server can send to any connected client.
Skip negotiation bypasses the initial HTTP request that determines transport. Use it when you know WebSocket is supported and want faster connection establishment. Don't use it if you need fallbacks.
Inject
IHubContext<THub>and use itsClientsproperty to send messages. The background service doesn't need a connection - it uses the server's infrastructure.
Create groups prefixed with tenant ID (e.g.,
tenant:{tenantId}). On connection, validate the tenant claim and add to appropriate groups. Always scope group names by tenant for isolation.
No. Service Workers can't maintain WebSocket connections. The pattern is: SignalR → Main Thread → postMessage → Service Worker → OS Notification. Service Workers only handle display.