azure-signalr-dev - Microsoft.Azure.SignalR.Serverless.Protocols 1.6.0

Package Description

PM> Install-Package Microsoft.Azure.SignalR.Serverless.Protocols -Version 1.6.0 -Source https://www.myget.org/F/azure-signalr-dev/api/v3/index.json

Copy to clipboard

> nuget.exe install Microsoft.Azure.SignalR.Serverless.Protocols -Version 1.6.0 -Source https://www.myget.org/F/azure-signalr-dev/api/v3/index.json

Copy to clipboard

> dotnet add package Microsoft.Azure.SignalR.Serverless.Protocols --version 1.6.0 --source https://www.myget.org/F/azure-signalr-dev/api/v3/index.json

Copy to clipboard
<PackageReference Include="Microsoft.Azure.SignalR.Serverless.Protocols" Version="1.6.0" />
Copy to clipboard
source https://www.myget.org/F/azure-signalr-dev/api/v3/index.json

nuget Microsoft.Azure.SignalR.Serverless.Protocols  ~> 1.6.0
Copy to clipboard

> choco install Microsoft.Azure.SignalR.Serverless.Protocols --version 1.6.0 --source https://www.myget.org/F/azure-signalr-dev/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "azure-signalr-dev" -SourceLocation "https://www.myget.org/F/azure-signalr-dev/api/v2"
Install-Module -Name "Microsoft.Azure.SignalR.Serverless.Protocols" -RequiredVersion "1.6.0" -Repository "azure-signalr-dev" 
Copy to clipboard

Azure Functions Bindings for Azure SignalR Service

Build Status

Travis: travis

NuGet Packages

Package Name Target Framework NuGet
Microsoft.Azure.WebJobs.Extensions.SignalRService .NET Core App 2.1
.NET Core App 3.1
NuGet

Intro

These bindings allow Azure Functions to integrate with Azure SignalR Service.

Supported scenarios

  • Allow clients to serverlessly connect to a SignalR Service hub without requiring an ASP.NET Core backend
  • Use Azure Functions (any language supported by V2) to broadcast messages to all clients connected to a SignalR Service hub.
  • Use Azure Functions (any language supported by V2) to send messages to a single user, or all the users in a group.
  • Use Azure Functions (any language supported by V2) to manage group users like add/remove a single user in a group.
  • Example scenarios include: broadcast messages to a SignalR Service hub on HTTP requests and events from Cosmos DB change feed, Event Hub, Event Grid, etc
  • Use multiple Azure SignalR Service instances for resiliency and disaster recovery in Azure Functions. See details in Multiple SignalR service endpoint support.

Bindings

SignalRConnectionInfo input binding makes it easy to generate the token required for clients to initiate a connection to Azure SignalR Service.

SignalR output binding allows messages to be broadcast to an Azure SignalR Service hub.

Prerequisites

Usage

Create Azure SignalR Service instance

  1. Create Azure SignalR Service instances in the Azure Portal. Note the connection strings, you'll need them later.

Create Function App with extension

  1. In a new folder, create a new Azure Functions app.
    • func init
  2. Install this Functions extension.
    • func extensions install -p Microsoft.Azure.WebJobs.Extensions.SignalRService -v 1.0.0

Add application setting for SignalR connection string

  1. Create an app setting called AzureSignalRConnectionString with the SignalR connection string.
    • On localhost, use local.settings.json
    • In Azure, use App Settings

Using the SignalRConnectionInfo input binding

In order for a client to connect to SignalR, it needs to obtain the SignalR Service client hub URL and an access token.

  1. Create a new function named negotiate and use the SignalRConnectionInfo input binding to obtain the connection information and return it. Take a look at this sample.
  2. Client connects to the negotiate function as it's a normal SignalR hub. See this file for a sample usage.

Binding schema:

{
  "type": "signalRConnectionInfo",
  "name": "connectionInfo",
  "hubName": "<hub_name>",
  "connectionStringSetting": "<setting_name>", // Defaults to AzureSignalRConnectionString
  "direction": "in"
}

Using the SignalR output binding

The SignalR output binding can be used to broadcast messages to all clients connected a hub. Take a look at this sample:

Binding schema:

{
  "type": "signalR",
  "name": "signalRMessages", // name of the output binding
  "hubName": "<hub_name>",
  "connectionStringSetting": "<setting_name>", // Defaults to AzureSignalRConnectionString
  "direction": "out"
}

To send one or more messages, set the output binding to an array of objects:

module.exports = function (context, req) {
  context.bindings.signalRMessages = [{
    "target": "newMessage", // name of the client method to invoke
    "arguments": [
      req.body // arguments to pass to client method
    ]
  }];
  context.done();
};

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

  • .NETStandard 2.0
    • MessagePack (>= 1.9.11)
    • Microsoft.AspNetCore.SignalR.Protocols.MessagePack (>= 1.1.5)
    • Newtonsoft.Json (>= 12.0.2)
    • System.Memory (>= 4.5.3)
  • .NETStandard 2.0: 2.0.0.0

Signature validation information

Informational

Signature Hash Algorithm: SHA256

Timestamp: 9/13/2021 7:27:09 AM

Verifying author primary signature's timestamp with timestamping service certificate: 
  Subject Name: CN=Symantec SHA256 TimeStamping Signer - G3, OU=Symantec Trust Network, O=Symantec Corporation, C=US
  SHA1 hash: A9A4121063D71D48E8529A4681DE803E3E7954B0
  SHA256 hash: C474CE76007D02394E0DA5E4DE7C14C680F9E282013CFEF653EF5DB71FDF61F8
  Issued by: CN=Symantec SHA256 TimeStamping CA, OU=Symantec Trust Network, O=Symantec Corporation, C=US
  Valid from: 12/23/2017 12:00:00 AM to 3/22/2029 11:59:59 PM

Signature type: Author

Verifying the author primary signature with certificate: 
  Subject Name: CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
  SHA1 hash: A6E18D21B507879FC7F9C392A5CE355936E3AD2C
  SHA256 hash: AA12DA22A49BCE7D5C1AE64CC1F3D892F150DA76140F210ABD2CBFFCA2C18A27
  Issued by: CN=DigiCert SHA2 Assured ID Code Signing CA, OU=www.digicert.com, O=DigiCert Inc, C=US
  Valid from: 9/30/2020 12:00:00 AM to 10/5/2023 12:00:00 PM

Owners

JialinXin Yang Zitong Liangying Chenyang Liu

Authors

Microsoft

Project URL

https://github.com/Azure/azure-functions-signalrservice-extension

License

MIT

Signature

Validation: Valid

Info

27 total downloads
3 downloads for version 1.6.0
Download (19.25 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
1.10.1-preview1-11168 28.79 KB Fri, 17 May 2024 06:40:24 GMT 0
1.10.1-preview1-11167 28.8 KB Thu, 16 May 2024 09:27:10 GMT 0
1.10.1-preview1-11166 28.79 KB Tue, 14 May 2024 09:21:23 GMT 0
1.10.1-preview1-11156 28.8 KB Fri, 22 Mar 2024 07:58:16 GMT 1
1.10.0 28.75 KB Wed, 31 Jan 2024 09:02:07 GMT 1
1.10.0-preview1-11154 28.79 KB Fri, 01 Mar 2024 04:28:24 GMT 1
1.10.0-preview1-11152 28.8 KB Wed, 21 Feb 2024 09:03:31 GMT 1
1.9.0 49.54 KB Wed, 15 Jun 2022 07:52:21 GMT 2
1.9.0-preview1-10984 49.58 KB Wed, 08 Jun 2022 05:34:00 GMT 2
1.6.0 19.25 KB Mon, 13 Sep 2021 07:29:07 GMT 3
1.5.0 19.25 KB Fri, 16 Jul 2021 05:29:41 GMT 2
1.4.2 19.26 KB Wed, 16 Jun 2021 03:19:44 GMT 2
1.4.1 19.28 KB Tue, 25 May 2021 04:36:44 GMT 2
1.4.0 19.28 KB Wed, 12 May 2021 06:52:47 GMT 2
1.3.0 19.25 KB Fri, 19 Mar 2021 06:01:55 GMT 3
1.2.2 22.83 KB Thu, 10 Dec 2020 04:36:58 GMT 1
1.2.1 19.26 KB Fri, 18 Sep 2020 02:32:56 GMT 2
1.2.0 19.26 KB Mon, 01 Jun 2020 08:28:47 GMT 2