Azure Web PubSub · Arazzo Workflow

Azure Web PubSub Check then Close Connection

Version 1.0.0

Verify a connection exists before closing it, branching on whether it is present.

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

Provider

microsoft-azure-web-pubsub

Workflows

check-then-close-connection
Check whether a connection exists, then close it if present.
Probes a connection with connectionExists and branches: when the HEAD returns 200 it closes the connection via closeConnection, otherwise it ends.
2 steps inputs: accessToken, apiVersion, connectionId, hub, reason outputs: closeStatus, existsStatus
1
checkConnection
webPubSub_connectionExists
Probe whether the connection is still attached to the hub. A 200 means it exists; a 404 means it is already gone.
2
closeConnection
webPubSub_closeConnection
Close the existing connection, optionally recording a reason.

Source API Descriptions

Arazzo Workflow Specification

microsoft-azure-web-pubsub-check-then-close-connection-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Azure Web PubSub Check then Close Connection
  summary: Verify a connection exists before closing it, branching on whether it is present.
  description: >-
    A guarded teardown pattern: an app server first probes whether a specific
    connection is still attached to the hub, and only when it exists proceeds to
    close it. When the connection is already gone the flow ends without issuing a
    close. Each step inlines its request — Authorization bearer header, required
    api-version query, and documented HEAD 200/404 and DELETE 204 status codes.
  version: 1.0.0
sourceDescriptions:
- name: webPubSubApi
  url: ../openapi/microsoft-azure-web-pubsub-openapi.yml
  type: openapi
workflows:
- workflowId: check-then-close-connection
  summary: Check whether a connection exists, then close it if present.
  description: >-
    Probes a connection with connectionExists and branches: when the HEAD returns
    200 it closes the connection via closeConnection, otherwise it ends.
  inputs:
    type: object
    required:
    - accessToken
    - hub
    - connectionId
    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.
      connectionId:
        type: string
        description: The connection id to check and close.
      reason:
        type: string
        description: Optional reason recorded when closing the connection.
  steps:
  - stepId: checkConnection
    description: >-
      Probe whether the connection is still attached to the hub. A 200 means it
      exists; a 404 means it is already gone.
    operationId: webPubSub_connectionExists
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: hub
      in: path
      value: $inputs.hub
    - name: connectionId
      in: path
      value: $inputs.connectionId
    - name: api-version
      in: query
      value: $inputs.apiVersion
    successCriteria:
    - condition: $statusCode == 200 || $statusCode == 404
    outputs:
      existsStatus: $statusCode
    onSuccess:
    - name: connectionPresent
      type: goto
      stepId: closeConnection
      criteria:
      - condition: $statusCode == 200
    - name: connectionAbsent
      type: end
      criteria:
      - condition: $statusCode == 404
  - stepId: closeConnection
    description: >-
      Close the existing connection, optionally recording a reason.
    operationId: webPubSub_closeConnection
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: hub
      in: path
      value: $inputs.hub
    - name: connectionId
      in: path
      value: $inputs.connectionId
    - name: api-version
      in: query
      value: $inputs.apiVersion
    - name: reason
      in: query
      value: $inputs.reason
    successCriteria:
    - condition: $statusCode == 204
    outputs:
      closeStatus: $statusCode
  outputs:
    existsStatus: $steps.checkConnection.outputs.existsStatus
    closeStatus: $steps.closeConnection.outputs.closeStatus