Build real-time Apps with Azure Functions and Azure SignalR Service
Because Azure SignalR Service and Azure Functions are both fully managed, highly scalable services that allow you to focus on building applications instead of managing infrastructure, it's common to use the two services together to provide real-time communications in a serverless environment.
Learn to use SignalR and Azure Functions together in the interactive tutorial Enable automatic updates in a web application using Azure Functions and SignalR Service.
Integrate real-time communications with Azure services
- HTTP and webhook requests
- Periodic timers
- Events from Azure services, such as:
- Event Grid
- Event Hubs
- Service Bus
- Cosmos DB change feed
- Storage - blobs and queues
- Logic Apps connectors such as Salesforce and SQL Server
By using Azure Functions to integrate these events with Azure SignalR Service, you have the ability to notify thousands of clients whenever events occur.
Some common scenarios for real-time serverless messaging that you can implement with Azure Functions and SignalR Service include:
- Visualize IoT device telemetry on a real-time dashboard or map
- Update data in an application when documents update in Cosmos DB
- Send in-app notifications when new orders are created in Salesforce
SignalR Service bindings for Azure Functions
An example scenario
An example of how to use the SignalR Service bindings is using Azure Functions to integrate with Azure Cosmos DB and SignalR Service to send real-time messages when new events appear on a Cosmos DB change feed.
- A change is made in a Cosmos DB collection
- The change event is propagated to the Cosmos DB change feed
- An Azure Functions is triggered by the change event using the Cosmos DB trigger
- The SignalR Service output binding publishes a message to SignalR Service
- SignalR Service publishes the message to all connected clients
Authentication and users
SignalR Service allows you to broadcast messages to all clients or only to a subset of clients, such as those belonging to a single user. The SignalR Service bindings for Azure Functions can be combined with App Service Authentication to authenticate users with providers such as Azure Active Directory, Facebook, and Twitter. You can then send messages directly to these authenticated users.
In this article, you got an overview of how to use Azure Functions with SignalR Service to enable a wide array of serverless real-time messaging scenarios.
For full details on how to use Azure Functions and SignalR Service together visit the following resources:
- Azure Functions development and configuration with SignalR Service
- Enable automatic updates in a web application using Azure Functions and SignalR Service
Follow one of these quickstarts to learn more.