Web Pub Sub - Send To All

Broadcast content inside request body to all the connected client connections.

POST {Endpoint}/api/hubs/{hub}/:send?api-version=2022-11-01
POST {Endpoint}/api/hubs/{hub}/:send?excluded={excluded}&api-version=2022-11-01&filter={filter}

URI Parameters

Name In Required Type Description
Endpoint
path True
  • string

HTTP or HTTPS endpoint for the Web PubSub service instance.

hub
path True
  • string

Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

Regex pattern: ^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$

api-version
query True
  • string

The version of the REST APIs.

excluded
query
  • array

Excluded connection Ids.

filter
query
  • string

Following OData filter syntax to filter out the subscribers receiving the messages.

Request Body

Media Types: "application/octet-stream", "text/plain", "application/json"

Name Type Description
message
  • string

The payload body.

Responses

Name Type Description
202 Accepted

The message is accepted. The service follows fire-and-forget pattern when sending messages.

Other Status Codes

Error response

Headers

  • x-ms-error-code: string

Examples

WebPubSub_SendToAll

Sample Request

POST {Endpoint}/api/hubs/hub1/:send?api-version=2022-11-01&filter=startswith(userId, 'listener-')

"Message to send"

Sample Response

Definitions

ErrorDetail

The error object.

InnerError

ErrorDetail

The error object.

Name Type Description
code
  • string

One of a server-defined set of error codes.

details

An array of details about specific errors that led to this reported error.

inner
message
  • string

A human-readable representation of the error.

target
  • string

The target of the error.

InnerError

Name Type Description
code
  • string

A more specific error code than was provided by the containing error.

inner