Send To Connection - Send To Connection
将请求正文中的内容发送到特定连接。
POST {endpoint}/api/hubs/{hub}/connections/{connectionId}/:send?api-version=2024-12-01
POST {endpoint}/api/hubs/{hub}/connections/{connectionId}/:send?api-version=2024-12-01&messageTtlSeconds={messageTtlSeconds}
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
connection
|
path | True |
string minLength: 1 |
连接 ID。 |
|
endpoint
|
path | True |
string (uri) |
Web PubSub 服务实例的 HTTP 或 HTTPS 终结点 |
|
hub
|
path | True |
string pattern: ^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$ |
目标中心名称,应以字母字符开头,仅包含字母数字字符或下划线。 |
|
api-version
|
query | True |
string minLength: 1 |
用于此作的 API 版本。 |
|
message
|
query |
integer (int32) minimum: 0maximum: 300 |
发送到服务的消息的生存时间 (TTL) 值(以秒为单位)。 0 是默认值,这意味着消息永远不会过期。 300 是最大值。 如果此参数为非零,则服务将丢弃客户端在指定 TTL 内未使用的消息。 当客户端的带宽有限时,此参数可以提供帮助。 |
请求正文
Media Types: "application/json", "application/octet-stream", "text/plain"
| 名称 | 类型 | 说明 |
|---|---|---|
| message |
string (byte) |
有效载荷主体。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 202 Accepted |
已接受请求进行处理,但尚未完成处理。 |
|
| Other Status Codes |
意外错误响应。 标头 x-ms-error-code: string |
安全性
OAuth2Auth
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
| 名称 | 说明 |
|---|---|
| https://webpubsub.azure.com/.default |
示例
SendToConnection
示例请求
POST {endpoint}/api/hubs/hub1/connections/connection1/:send?api-version=2024-12-01&messageTtlSeconds=15
"TWVzc2FnZSB0byBzZW5k"
示例响应
定义
| 名称 | 说明 |
|---|---|
|
Azure. |
错误对象。 |
|
Azure. |
包含错误详细信息的响应。 |
|
Azure. |
包含有关错误的更具体信息的对象。 根据Azure REST API指南——https://aka.ms/AzureRestApiGuidelines#handling-errors。 |
Azure.Core.Foundations.Error
错误对象。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的一组错误代码之一。 |
| details |
有关导致此报告错误的特定错误的一系列详细信息。 |
|
| innererror |
包含比当前对象更具体的错误信息的对象。 |
|
| message |
string |
错误的人类可读表示。 |
| target |
string |
错误的目标。 |
Azure.Core.Foundations.ErrorResponse
包含错误详细信息的响应。
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误对象。 |
Azure.Core.Foundations.InnerError
包含有关错误的更具体信息的对象。 根据Azure REST API指南——https://aka.ms/AzureRestApiGuidelines#handling-errors。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的一组错误代码之一。 |
| innererror |
内部错误。 |