Azure Web PubSub · Arazzo Workflow

Azure Web PubSub Broadcast to Group if Active

Version 1.0.0

Only broadcast to a group when it currently has connected members.

1 workflow 1 source API 1 provider
View Spec View on GitHub MessagingPub-SubReal-TimeServerlessWebSocketsArazzoWorkflows

Provider

microsoft-azure-web-pubsub

Workflows

broadcast-to-group-if-active
Check whether a group has connections, then broadcast only if it does.
Probes a group with groupExists and branches: when the HEAD returns 200 it broadcasts via sendToGroup, otherwise it ends.
2 steps inputs: accessToken, apiVersion, group, hub, message outputs: groupStatus, sendStatus
1
checkGroup
webPubSub_groupExists
Probe whether the group currently has any connected members. A 200 means it is active; a 404 means it is empty.
2
broadcastGroup
webPubSub_sendToGroup
Broadcast the supplied plain-text message to every connection in the group.

Source API Descriptions

Arazzo Workflow Specification

microsoft-azure-web-pubsub-group-broadcast-if-active-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Azure Web PubSub Broadcast to Group if Active
  summary: Only broadcast to a group when it currently has connected members.
  description: >-
    A conditional fan-out pattern: the app server checks whether a group has any
    live connections before broadcasting, avoiding a wasted send to an empty
    group. When the group is active a message is broadcast to all of its members;
    when it is empty the flow ends. Each step inlines its request — Authorization
    bearer header, required api-version query, the message body, and documented
    HEAD 200/404 and send 202 status codes.
  version: 1.0.0
sourceDescriptions:
- name: webPubSubApi
  url: ../openapi/microsoft-azure-web-pubsub-openapi.yml
  type: openapi
workflows:
- workflowId: broadcast-to-group-if-active
  summary: Check whether a group has connections, then broadcast only if it does.
  description: >-
    Probes a group with groupExists and branches: when the HEAD returns 200 it
    broadcasts via sendToGroup, otherwise it ends.
  inputs:
    type: object
    required:
    - accessToken
    - hub
    - group
    - message
    properties:
      accessToken:
        type: string
        description: JWT bearer token for the Web PubSub data plane.
      apiVersion:
        type: string
        description: Data plane REST API version.
        default: "2024-01-01"
      hub:
        type: string
        description: Target hub name.
      group:
        type: string
        description: Group name to check and broadcast to.
      message:
        type: string
        description: The plain-text message to broadcast to the group.
  steps:
  - stepId: checkGroup
    description: >-
      Probe whether the group currently has any connected members. A 200 means
      it is active; a 404 means it is empty.
    operationId: webPubSub_groupExists
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: hub
      in: path
      value: $inputs.hub
    - name: group
      in: path
      value: $inputs.group
    - name: api-version
      in: query
      value: $inputs.apiVersion
    successCriteria:
    - condition: $statusCode == 200 || $statusCode == 404
    outputs:
      groupStatus: $statusCode
    onSuccess:
    - name: groupActive
      type: goto
      stepId: broadcastGroup
      criteria:
      - condition: $statusCode == 200
    - name: groupEmpty
      type: end
      criteria:
      - condition: $statusCode == 404
  - stepId: broadcastGroup
    description: >-
      Broadcast the supplied plain-text message to every connection in the group.
    operationId: webPubSub_sendToGroup
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: hub
      in: path
      value: $inputs.hub
    - name: group
      in: path
      value: $inputs.group
    - name: api-version
      in: query
      value: $inputs.apiVersion
    requestBody:
      contentType: text/plain
      payload: $inputs.message
    successCriteria:
    - condition: $statusCode == 202
    outputs:
      sendStatus: $statusCode
  outputs:
    groupStatus: $steps.checkGroup.outputs.groupStatus
    sendStatus: $steps.broadcastGroup.outputs.sendStatus