Azure SignalR Service REST API
Bài viết 04/03/2023
1 người đóng góp
Phản hồi
Trong bài viết này
Version: 2022-06-01
Available APIs
/api/health
HEAD
Summary
Get service health status.
Get service health status
HEAD /api/health
Parameters
Name
Located in
Description
Required
Schema
api-version
query
The version of the REST APIs.
Yes
string
Responses
Code
Description
200
The service is healthy
default
Error response
/api/hubs/{hub}/:closeConnections
POST
Summary
Close all of the connections in the hub.
Close all of the connections in the hub
POST /api/hubs/{hub}/:closeConnections
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
excluded
query
Exclude these connectionIds when closing the connections in the hub.
No
[ string ]
reason
query
The reason closing the client connections.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
Code
Description
Schema
204
Success
default
Error response
ErrorDetail
/api/hubs/{hub}/:send
POST
Summary
Broadcast a message to all clients connected to target hub.
Broadcast a message to all clients connected to target hub
POST /api/hubs/{hub}/:send
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
excluded
query
Excluded connection Ids
No
[ string ]
api-version
query
The version of the REST APIs.
Yes
string
message
body
The payload message.
Yes
PayloadMessage
Responses
/api/hubs/{hub}/connections/{connectionId}
HEAD
Summary
Check if the connection with the given connectionId exists
Check if the connection with the given connectionId exists
HEAD /api/hubs/{hub}/connections/{connectionId}
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
connectionId
path
The connection Id.
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
DELETE
Summary
Close the client connection
Close the client connection
DELETE /api/hubs/{hub}/connections/{connectionId}
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
connectionId
path
The connection Id.
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
reason
query
The reason of the connection close.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
/api/hubs/{hub}/connections/{connectionId}/:send
POST
Summary
Send message to the specific connection.
Send message to the specific connection
POST /api/hubs/{hub}/connections/{connectionId}/:send
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
connectionId
path
The connection Id.
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
api-version
query
The version of the REST APIs.
Yes
string
message
body
The payload message.
Yes
PayloadMessage
Responses
/api/hubs/{hub}/groups/{group}
HEAD
Summary
Check if there are any client connections inside the given group
Check if there are any client connections inside the given group
HEAD /api/hubs/{hub}/groups/{group}
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
group
path
Target group name, which length should be greater than 0 and less than 1025.
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
/api/hubs/{hub}/groups/{group}/:closeConnections
POST
Summary
Close connections in the specific group.
Close connections in the specific group
POST /api/hubs/{hub}/groups/{group}/:closeConnections
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
group
path
Target group name, which length should be greater than 0 and less than 1025.
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
excluded
query
Exclude these connectionIds when closing the connections in the hub.
No
[ string ]
reason
query
The reason closing the client connections.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
Code
Description
Schema
204
Success
default
Error response
ErrorDetail
/api/hubs/{hub}/groups/{group}/:send
POST
Summary
Broadcast a message to all clients within the target group.
Broadcast a message to all clients within the target group
POST /api/hubs/{hub}/groups/{group}/:send
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
group
path
Target group name, which length should be greater than 0 and less than 1025.
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
excluded
query
Excluded connection Ids
No
[ string ]
api-version
query
The version of the REST APIs.
Yes
string
message
body
The payload message.
Yes
PayloadMessage
Responses
/api/hubs/{hub}/groups/{group}/connections/{connectionId}
PUT
Summary
Add a connection to the target group.
Add a connection to the target group
PUT /api/hubs/{hub}/groups/{group}/connections/{connectionId}
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
group
path
Target group name, which length should be greater than 0 and less than 1025.
Yes
string
connectionId
path
Target connection Id
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
DELETE
Summary
Remove a connection from the target group.
Remove a connection from the target group
DELETE /api/hubs/{hub}/groups/{group}/connections/{connectionId}
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
group
path
Target group name, which length should be greater than 0 and less than 1025.
Yes
string
connectionId
path
Target connection Id
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
/api/hubs/{hub}/connections/{connectionId}/groups
DELETE
Summary
Remove a connection from all groups
Remove a connection from all groups
DELETE /api/hubs/{hub}/connections/{connectionId}/groups
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
connectionId
path
Target connection Id
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
/api/hubs/{hub}/users/{user}
HEAD
Summary
Check if there are any client connections connected for the given user
Check if there are any client connections connected for the given user
HEAD /api/hubs/{hub}/users/{user}
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
user
path
The user Id.
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
/api/hubs/{hub}/users/{user}/:closeConnections
POST
Summary
Close connections for the specific user.
Close connections for the specific user
POST /api/hubs/{hub}/users/{user}/:closeConnections
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
user
path
The user Id.
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
excluded
query
Exclude these connectionIds when closing the connections in the hub.
No
[ string ]
reason
query
The reason closing the client connections.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
Code
Description
Schema
204
Success
default
Error response
ErrorDetail
/api/hubs/{hub}/users/{user}/:send
POST
Summary
Broadcast a message to all clients belong to the target user.
Broadcast a message to all clients belong to the target user
POST /api/hubs/{hub}/users/{user}/:send
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
user
path
The user Id.
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
api-version
query
The version of the REST APIs.
Yes
string
message
body
The payload message.
Yes
PayloadMessage
Responses
/api/hubs/{hub}/users/{user}/groups/{group}
HEAD
Summary
Check whether a user exists in the target group.
Check whether a user exists in the target group
HEAD /api/hubs/{hub}/users/{user}/groups/{group}
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
group
path
Target group name, which length should be greater than 0 and less than 1025.
Yes
string
user
path
Target user Id
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
PUT
Summary
Add a user to the target group.
Add a user to the target group
PUT /api/hubs/{hub}/users/{user}/groups/{group}
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
group
path
Target group name, which length should be greater than 0 and less than 1025.
Yes
string
user
path
Target user Id
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
ttl
query
Specifies the seconds that the user exists in the group. If not set, the user lives in the group for 1 year at most. If a user is added to some groups without ttl limitation, only the latest updated 100 groups will be reserved among all groups the user joined without TTL. If ttl = 0, only the current connected connections of the target user will be added to the target group.
No
integer
api-version
query
The version of the REST APIs.
Yes
string
Responses
DELETE
Summary
Remove a user from the target group.
Remove a user from the target group
DELETE /api/hubs/{hub}/users/{user}/groups/{group}
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
group
path
Target group name, which length should be greater than 0 and less than 1025.
Yes
string
user
path
Target user Id
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
Code
Description
Schema
204
Success
default
Error response
ErrorDetail
/api/hubs/{hub}/users/{user}/groups
DELETE
Summary
Remove a user from all groups.
Remove a user from all groups
DELETE /api/hubs/{hub}/users/{user}/groups
Parameters
Name
Located in
Description
Required
Schema
hub
path
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
Yes
string
user
path
Target user Id
Yes
string
application
query
Target application name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
No
string
api-version
query
The version of the REST APIs.
Yes
string
Responses
Code
Description
Schema
204
Success
default
Error response
ErrorDetail
Models
ErrorDetail
The error object.
Name
Type
Description
Required
code
string
One of a server-defined set of error codes.
No
message
string
A human-readable representation of the error.
No
target
string
The target of the error.
No
details
[ ErrorDetail ]
An array of details about specific errors that led to this reported error.
No
inner
InnerError
No
InnerError
Name
Type
Description
Required
code
string
A more specific error code than was provided by the containing error.
No
inner
InnerError
No
PayloadMessage
Name
Type
Description
Required
target
string
Yes
arguments
[ ]
No
ServiceResponse
Name
Type
Description
Required
code
string
No
level
string
Enum: "Info"
, "Warning"
, "Error"
No
scope
string
Enum: "Unknown"
, "Request"
, "Connection"
, "User"
, "Group"
No
errorKind
string
Enum: "Unknown"
, "NotExisted"
, "NotInGroup"
, "Invalid"
No
message
string
No
jsonObject
No
isSuccess
boolean
No