Azure SignalR binding spec

Detailed documentation on the Azure SignalR binding component

Component format

To setup Azure SignalR binding create a component of type bindings.azure.signalr. See this guide on how to create and apply a binding configuration.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. namespace: <NAMESPACE>
  6. spec:
  7. type: bindings.azure.signalr
  8. version: v1
  9. metadata:
  10. - name: connectionString
  11. value: Endpoint=https://<your-azure-signalr>.service.signalr.net;AccessKey=<your-access-key>;Version=1.0;
  12. - name: hub # Optional
  13. value: <hub name>

Warning

以上示例将 Secret 明文存储。 更推荐的方式是使用 Secret 组件, here

Spec metadata fields

字段RequiredBinding supportDetailsExample
connectionStringYOutputThe Azure SignalR connection string“Endpoint=https://<your-azure-signalr>.service.signalr.net;AccessKey=<your-access-key>;Version=1.0;”
hubNOutputDefines the hub in which the message will be send. The hub can be dynamically defined as a metadata value when publishing to an output binding (key is “hub”)“myhub”

Output bindings

This component supports output binding with the following operations:

  • create

Additional information

By default the Azure SignalR output binding will broadcast messages to all connected users. To narrow the audience there are two options, both configurable in the Metadata property of the message:

  • group: Sends the message to a specific Azure SignalR group
  • user: Sends the message to a specific Azure SignalR user

Applications publishing to an Azure SignalR output binding should send a message with the following contract:

  1. {
  2. "data": {
  3. "Target": "<enter message name>",
  4. "Arguments": [
  5. {
  6. "sender": "dapr",
  7. "text": "Message from dapr output binding"
  8. }
  9. ]
  10. },
  11. "metadata": {
  12. "group": "chat123"
  13. },
  14. "operation": "create"
  15. }

For more information on integration Azure SignalR into a solution check the documentation

Related links

Last modified January 1, 0001