How azure/azure-signalr works
Purpose and deliverables
This is the .NET SDK for Azure SignalR Service: provider integrations for ASP.NET Core and legacy ASP.NET SignalR, a direct management SDK, shared service protocols, and a local serverless emulator. The build entry is AzureSignalR.sln; distributable package APIs are tracked under api/.
Provider entry points
ASP.NET Core applications register the Azure SignalR provider through DI and hosting/startup extensions, which replace or route SignalR lifetime and negotiate behavior through Azure SignalR. Legacy OWIN/ASP.NET SignalR has a separate integration surface.
• src/Microsoft.Azure.SignalR/DependencyInjectionExtensions.cs
• src/Microsoft.Azure.SignalR/Startup/AzureSignalRStartupFilter.cs
• src/Microsoft.Azure.SignalR.AspNet/OwinExtensions.cs
Core service-connection transport
The provider maintains outbound service connections, serializes application hub operations into service messages, and dispatches inbound messages back to local SignalR connections/hubs. Connection containers support multiple Azure endpoints and strong/weak connection modes, with acknowledgements, reconnection, shutdown, and routing boundaries.
• src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs
• src/Microsoft.Azure.SignalR.Common/ServiceConnections/MultiEndpointServiceConnectionContainer.cs
• src/Microsoft.Azure.SignalR/ServerConnections/ServiceConnectionManager.cs
Endpoint selection and authentication
Connection strings/configuration produce service endpoints; endpoint routers choose targets for negotiation and messages. Tokens are generated from access keys or Microsoft Entra credentials, forming the authorization boundary for service WebSocket and REST traffic.
• src/Microsoft.Azure.SignalR.Common/Endpoints/ServiceEndpoint.cs
• src/Microsoft.Azure.SignalR/EndpointRouters/DefaultEndpointRouter.cs
• src/Microsoft.Azure.SignalR.Common/Auth/MicrosoftEntra/MicrosoftEntraTokenProvider.cs
Protocol and message boundary
Microsoft.Azure.SignalR.Protocols defines the SDK-to-service message model and MessagePack-oriented service protocol. Common formatting/parsing supports binary and text frames; serverless JSON/MessagePack messages are separated into a dedicated protocol package.
• src/Microsoft.Azure.SignalR.Protocols/ServiceProtocol.cs
• src/Microsoft.Azure.SignalR.Protocols/ServiceMessage.cs
• src/Microsoft.Azure.SignalR.Serverless.Protocols/MessagePackServerlessProtocol.cs
Management SDK path
Non-hosted applications (including serverless workloads) create service hub contexts/managers to broadcast, manage clients/groups/users, negotiate clients, and perform health checks. It can use REST or WebSocket lifetime-manager transports, with resilient HTTP handlers around REST calls.
• src/Microsoft.Azure.SignalR.Management/ServiceManager.cs
• src/Microsoft.Azure.SignalR.Management/ServiceHubContextImpl.cs
• src/Microsoft.Azure.SignalR.Management/RestHubLifetimeManager.cs
Local emulator runtime
The emulator is a .NET 8 host and Docker-capable local substitute for serverless scenarios. It exposes service-like web APIs, dynamically manages hub connections/groups, proxies hub operations, and triggers configured HTTP upstreams.
• src/Microsoft.Azure.SignalR.Emulator/Program.cs
• src/Microsoft.Azure.SignalR.Emulator/Controllers/SignalRServiceEmulatorWebApi.cs
• src/Microsoft.Azure.SignalR.Emulator/HubEmulator/HubProxyHandler.cs
Runtime and external boundaries
The libraries target .NET Standard plus modern .NET variants; legacy ASP.NET support targets .NET Framework 4.6.2. Primary external systems are Azure SignalR Service (persistent WebSocket service connections and REST management APIs), Microsoft Entra authentication, ASP.NET Core SignalR/ASP.NET SignalR hosting, and optional HTTP upstream endpoints. CI is cross-platform GitHub Actions, with Azure release automation.
• src/Microsoft.Azure.SignalR/Microsoft.Azure.SignalR.csproj
• src/Microsoft.Azure.SignalR.Emulator/Dockerfile
• .azure/pipelines/release.yml
Components 23
Provider integrations
- DI registration
src/Microsoft.Azure.SignalR/DependencyInjectionExtensions.cs - Startup filter · Routes SignalR startup behavior through the provider.
src/Microsoft.Azure.SignalR/Startup/AzureSignalRStartupFilter.cs - OWIN integration
src/Microsoft.Azure.SignalR.AspNet/OwinExtensions.cs - Service connection manager · Owns provider-side service connections.
src/Microsoft.Azure.SignalR/ServerConnections/ServiceConnectionManager.cs - Default endpoint router
src/Microsoft.Azure.SignalR/EndpointRouters/DefaultEndpointRouter.cs
Shared transport
- Service connection base · Serializes outbound operations and dispatches inbound service messages.
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs - Multi-endpoint container · Manages strong and weak connections across Azure endpoints.
src/Microsoft.Azure.SignalR.Common/ServiceConnections/MultiEndpointServiceConnectionContainer.cs - Service endpoint
src/Microsoft.Azure.SignalR.Common/Endpoints/ServiceEndpoint.cs - Entra token provider · Creates service authorization tokens from Microsoft Entra credentials.
src/Microsoft.Azure.SignalR.Common/Auth/MicrosoftEntra/MicrosoftEntraTokenProvider.cs - Service protocol · MessagePack-oriented SDK-to-service framing.
src/Microsoft.Azure.SignalR.Protocols/ServiceProtocol.cs - Service messages
src/Microsoft.Azure.SignalR.Protocols/ServiceMessage.cs - Serverless protocol
src/Microsoft.Azure.SignalR.Serverless.Protocols/MessagePackServerlessProtocol.cs
Management SDK
- Service manager
src/Microsoft.Azure.SignalR.Management/ServiceManager.cs - Service hub context · Broadcasts and manages clients, groups, users, negotiation, and health.
src/Microsoft.Azure.SignalR.Management/ServiceHubContextImpl.cs - REST lifetime manager · Uses resilient HTTP calls for hub operations.
src/Microsoft.Azure.SignalR.Management/RestHubLifetimeManager.cs
Local emulator
- Emulator host · Docker-capable local serverless substitute.
src/Microsoft.Azure.SignalR.Emulator/Program.cs - Emulator web API
src/Microsoft.Azure.SignalR.Emulator/Controllers/SignalRServiceEmulatorWebApi.cs - Hub proxy handler · Manages local hub operations and configured upstream invocation.
src/Microsoft.Azure.SignalR.Emulator/HubEmulator/HubProxyHandler.cs
Other components
- ASP.NET Core SignalR host
- Legacy ASP.NET SignalR host
- Azure SignalR Service · Persistent WebSocket service connections and REST management APIs.
- Microsoft Entra
- HTTP upstreams
Connections 21
- ASP.NET Core SignalR host → DI registration: registers provider
- DI registration → Startup filter: installs
- Startup filter → Service connection manager: uses
- Legacy ASP.NET SignalR host → OWIN integration: configures
- OWIN integration → Service connection manager: uses
- Service connection manager → Default endpoint router: selects endpoint
- Service connection manager → Multi-endpoint container: manages
- Multi-endpoint container → Service connection base: creates
- Default endpoint router → Service endpoint: routes to
- Service endpoint → Entra token provider: authorizes with
- Entra token provider → Microsoft Entra: obtains token
- Service connection base → Service protocol: frames
- Service protocol → Service messages: encodes
- Service connection base → Azure SignalR Service: persistent WebSocket
- Service manager → Service hub context: creates
- Service hub context → REST lifetime manager: uses REST transport
- REST lifetime manager → Azure SignalR Service: management REST
- Emulator host → Emulator web API: hosts
- Emulator web API → Hub proxy handler: proxies operations
- Hub proxy handler → Serverless protocol: uses
- Hub proxy handler → HTTP upstreams: triggers