Get started with the Azure SignalR Service integration
Это содержимое пока не доступно на вашем языке.
Azure SignalR Service is a fully managed real-time messaging service that simplifies adding real-time web functionality to applications. The Aspire Azure SignalR Service integration lets you model a SignalR resource as a first-class resource in your AppHost, then hand the connection information to any consuming app.
Why use Azure SignalR Service with Aspire
Section titled “Why use Azure SignalR Service with Aspire”Adding Azure SignalR Service through Aspire — rather than wiring up connection strings and configuration by hand — gives you:
- Consistent connection info. Once you reference the SignalR resource from a consuming app, Aspire injects the endpoint as environment variables in a predictable format.
- Local emulation. In Serverless mode, Aspire can run the Azure SignalR emulator locally so you don’t need an Azure subscription for development.
- Built-in Bicep provisioning. The hosting integration automatically generates the Azure infrastructure needed to provision your SignalR resource for cloud deployment.
- Dashboard observability. The SignalR resource shows up in the Aspire dashboard alongside your other services.
- Managed identity support. The generated Bicep disables local authentication by default, encouraging secure managed identity connections.
How the pieces fit together
Section titled “How the pieces fit together”The Azure SignalR Service integration has two sides: a hosting integration that you use in your AppHost to model the SignalR resource, and a connection story for consuming apps that reference it.
architecture-beta group apphost(server)[AppHost] group consumer(server)[Consuming app] service hosting(server)[Hosting integration] in apphost service signalr(server)[Azure SignalR Service] in apphost service app(server)[App] in consumer hosting:R --> L:signalr signalr:R --> L:app
The hosting integration lives in your AppHost project and models the Azure SignalR Service resource. Consuming apps reference the resource and use the injected endpoint to communicate with SignalR.
Getting there is a two-step process: model the Azure SignalR resource in your AppHost, then connect to it from each app that needs it.
-
Model Azure SignalR Service in your AppHost
Section titled “Model Azure SignalR Service in your AppHost”Add the Azure SignalR Service hosting integration to your AppHost, then declare a SignalR resource and reference it from the apps that need it. The Azure SignalR Service hosting integration article walks through every capability — service modes, emulator, connecting to existing resources, and Bicep customization — with side-by-side C# and TypeScript examples.
Set up Azure SignalR Service in the AppHost
-
Connect from your consuming app
Section titled “Connect from your consuming app”When you reference an Azure SignalR Service resource from a consuming app, Aspire injects its endpoint as environment variables. See Connect to Azure SignalR Service for the connection properties reference and per-language examples for C#, Go, Python, and TypeScript.
Connect to Azure SignalR Service