Редактиране

Споделяне чрез


SignalR Service bindings for Azure Functions

This set of articles explains how to authenticate and send real-time messages to clients connected to Azure SignalR Service by using SignalR Service bindings in Azure Functions. Azure Functions runtime version 2.x and higher supports input and output bindings for SignalR Service.

Action Type
Handle messages from SignalR Service Trigger binding
Return the service endpoint URL and access token Input binding
Send SignalR Service messages and manage groups Output binding

Install extension

The extension NuGet package you install depends on the C# mode you're using in your function app:

Functions execute in an isolated C# worker process. To learn more, see Guide for running C# Azure Functions in an isolated worker process.

Add the extension to your project by installing this NuGet package.

Install bundle

The SignalR Service extension is part of an extension bundle, which is specified in your host.json project file. When you create a project that targets version 3.x or later, you should already have this bundle installed. To learn more, see extension bundle.

Add dependency

To use the SignalR Service annotations in Java functions, you need to add a dependency to the azure-functions-java-library-signalr artifact (version 1.0 or higher) to your pom.xml file.

<dependency>
    <groupId>com.microsoft.azure.functions</groupId>
    <artifactId>azure-functions-java-library-signalr</artifactId>
    <version>1.0.0</version>
</dependency>

Connection string settings

Add the AzureSignalRConnectionString key to the host.json file that points to the application setting with your connection string. For local development, this value may exist in the local.settings.json file.

For details on how to configure and use SignalR Service and Azure Functions together, refer to Azure Functions development and configuration with Azure SignalR Service.

Next steps