WebPubSubServiceClient Class
- java.
lang. Object - com.
azure. messaging. webpubsub. WebPubSubServiceClient
- com.
public final class WebPubSubServiceClient
Initializes a new instance of the synchronous AzureWebPubSubServiceRestAPI type.
Method Summary
Methods inherited from java.lang.Object
Method Details
addConnectionsToGroups
public void addConnectionsToGroups(List<String> groups, String filter)
Add filtered connections to multiple groups.
Request Body Schema
{
groups: Iterable (Optional)
filter: String (Optional)
}
Parameters:
addConnectionToGroupWithResponse
public Response<Void> addConnectionToGroupWithResponse(String group, String connectionId, RequestOptions requestOptions)
Add a connection to the target group.
Parameters:
Returns:
addUserToGroupWithResponse
public Response<Void> addUserToGroupWithResponse(String group, String userId, RequestOptions requestOptions)
Add a user to the target group.
Parameters:
Returns:
checkPermissionWithResponse
public Response<Boolean> checkPermissionWithResponse(WebPubSubPermission permission, String connectionId, RequestOptions requestOptions)
Check if a connection has permission to the specified action.
Parameters:
Returns:
closeAllConnectionsWithResponse
public Response<Void> closeAllConnectionsWithResponse(RequestOptions requestOptions)
Close the connections in the hub.
Query Parameters
| ---------- | ------ | -------- | -------------------------------------------------------------------- |
| Name | Type | Required | Description |
| excluded | String | No | Exclude these connectionIds when closing the connections in the hub. |
| reason | String | No | The reason closing the client connection. |
| apiVersion | String | Yes | Api Version |
Parameters:
Returns:
closeConnectionWithResponse
public Response<Void> closeConnectionWithResponse(String connectionId, RequestOptions requestOptions)
Close the client connection.
Parameters:
Returns:
closeGroupConnectionsWithResponse
public Response<Void> closeGroupConnectionsWithResponse(String group, RequestOptions requestOptions)
Close connections in the specific group.
Query Parameters
| ---------- | ------ | -------- | ---------------------------------------------------------------------- |
| Name | Type | Required | Description |
| excluded | String | No | Exclude these connectionIds when closing the connections in the group. |
| reason | String | No | The reason closing the client connection. |
| apiVersion | String | Yes | Api Version |
Parameters:
Returns:
closeUserConnectionsWithResponse
public Response<Void> closeUserConnectionsWithResponse(String userId, RequestOptions requestOptions)
Close connections for the specific user.
Query Parameters
| ---------- | ------ | -------- | ---------------------------------------------------------------------- |
| Name | Type | Required | Description |
| excluded | String | No | Exclude these connectionIds when closing the connections for the user. |
| reason | String | No | The reason closing the client connection. |
| apiVersion | String | Yes | Api Version |
Parameters:
Returns:
connectionExistsWithResponse
public Response<Boolean> connectionExistsWithResponse(String connectionId, RequestOptions requestOptions)
Check if the connection with the given connectionId exists.
Parameters:
Returns:
getClientAccessToken
public WebPubSubClientAccessToken getClientAccessToken(GetClientAccessTokenOptions options)
Creates a client access token.
Parameters:
Returns:
grantPermissionWithResponse
public Response<Void> grantPermissionWithResponse(WebPubSubPermission permission, String connectionId, RequestOptions requestOptions)
Grant permission to the connection.
Parameters:
Returns:
groupExistsWithResponse
public Response<Boolean> groupExistsWithResponse(String group, RequestOptions requestOptions)
Check if there are any client connections inside the given group.
Parameters:
Returns:
listConnectionsInGroup
public PagedIterable<WebPubSubGroupConnection> listConnectionsInGroup(String group, RequestOptions requestOptions)
List connections in a group.
Query Parameters
| ----------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| Name | Type | Required | Description |
| maxpagesize | Integer | No | The maximum number of connections to include in a single response. It should be between 1 and 200. |
| top | Integer | No | The maximum number of connections to return. If the value is not set, then all the connections in a group are returned. |
You can add these to a request with RequestOptions#addQueryParam
Response Body Schema
{
connectionId: String (Required)
userId: String (Optional)
}
Parameters:
Returns:
removeConnectionFromAllGroupsWithResponse
public Response<Void> removeConnectionFromAllGroupsWithResponse(String connectionId, RequestOptions requestOptions)
Remove a connection from all groups.
Parameters:
Returns:
removeConnectionFromGroupWithResponse
public Response<Void> removeConnectionFromGroupWithResponse(String group, String connectionId, RequestOptions requestOptions)
Remove a connection from the target group.
Parameters:
Returns:
removeUserFromAllGroupsWithResponse
public Response<Void> removeUserFromAllGroupsWithResponse(String userId, RequestOptions requestOptions)
Remove a user from all groups.
Parameters:
Returns:
removeUserFromGroupWithResponse
public Response<Void> removeUserFromGroupWithResponse(String group, String userId, RequestOptions requestOptions)
Remove a user from the target group.
Parameters:
Returns:
revokePermissionWithResponse
public Response<Void> revokePermissionWithResponse(WebPubSubPermission permission, String connectionId, RequestOptions requestOptions)
Revoke permission for the connection.
Parameters:
Returns:
sendToAll
public void sendToAll(String message, WebPubSubContentType contentType)
Broadcast content inside request body to all the connected client connections.
Parameters:
sendToAllWithResponse
public Response<Void> sendToAllWithResponse(BinaryData message, RequestOptions requestOptions)
Broadcast content inside request body to all the connected client connections.
Parameters:
Returns:
sendToAllWithResponse
public Response<Void> sendToAllWithResponse(BinaryData message, WebPubSubContentType contentType, long contentLength, RequestOptions requestOptions)
Broadcast content inside request body to all the connected client connections.
Parameters:
Returns:
sendToConnection
public void sendToConnection(String connectionId, String message, WebPubSubContentType contentType)
Send content inside request body to the specific connection.
Parameters:
sendToConnectionWithResponse
public Response<Void> sendToConnectionWithResponse(String connectionId, BinaryData message, RequestOptions requestOptions)
Send content inside request body to the specific connection.
Parameters:
Returns:
sendToConnectionWithResponse
public Response<Void> sendToConnectionWithResponse(String connectionId, BinaryData message, WebPubSubContentType contentType, long contentLength, RequestOptions requestOptions)
Send content inside request body to the specific connection.
Parameters:
Returns:
sendToGroup
public void sendToGroup(String group, String message, WebPubSubContentType contentType)
Send content inside request body to a group of connections.
Parameters:
sendToGroupWithResponse
public Response<Void> sendToGroupWithResponse(String group, BinaryData message, RequestOptions requestOptions)
Send content inside request body to a group of connections.
Parameters:
Returns:
sendToGroupWithResponse
public Response<Void> sendToGroupWithResponse(String group, BinaryData message, WebPubSubContentType contentType, long contentLength, RequestOptions requestOptions)
Send content inside request body to a group of connections.
Parameters:
Returns:
sendToUser
public void sendToUser(String userId, String message, WebPubSubContentType contentType)
Send content inside request body to the specific user.
Parameters:
sendToUserWithResponse
public Response<Void> sendToUserWithResponse(String userId, BinaryData message, RequestOptions requestOptions)
Send content inside request body to the specific user.
Parameters:
Returns:
sendToUserWithResponse
public Response<Void> sendToUserWithResponse(String userId, BinaryData message, WebPubSubContentType contentType, long contentLength, RequestOptions requestOptions)
Send content inside request body to the specific user.
Parameters:
Returns:
userExistsWithResponse
public Response<Boolean> userExistsWithResponse(String userId, RequestOptions requestOptions)
Check if there are any client connections connected for the given user.
Parameters:
Returns: