Package com.azure.messaging.webpubsub
Class WebPubSubServiceClient
java.lang.Object
com.azure.messaging.webpubsub.WebPubSubServiceClient
Initializes a new instance of the synchronous AzureWebPubSubServiceRestAPI type.
-
Method Summary
Modifier and TypeMethodDescriptionaddConnectionToGroupWithResponse
(String group, String connectionId, RequestOptions requestOptions) Add a connection to the target group.addUserToGroupWithResponse
(String group, String userId, RequestOptions requestOptions) Add a user to the target group.checkPermissionWithResponse
(WebPubSubPermission permission, String connectionId, RequestOptions requestOptions) Check if a connection has permission to the specified action.closeAllConnectionsWithResponse
(RequestOptions requestOptions) Close the connections in the hub.closeConnectionWithResponse
(String connectionId, RequestOptions requestOptions) Close the client connection.closeGroupConnectionsWithResponse
(String group, RequestOptions requestOptions) Close connections in the specific group.closeUserConnectionsWithResponse
(String userId, RequestOptions requestOptions) Close connections for the specific user.connectionExistsWithResponse
(String connectionId, RequestOptions requestOptions) Check if the connection with the given connectionId exists.Creates a client access token.grantPermissionWithResponse
(WebPubSubPermission permission, String connectionId, RequestOptions requestOptions) Grant permission to the connection.groupExistsWithResponse
(String group, RequestOptions requestOptions) Check if there are any client connections inside the given group.removeConnectionFromGroupWithResponse
(String group, String connectionId, RequestOptions requestOptions) Remove a connection from the target group.removeUserFromAllGroupsWithResponse
(String userId, RequestOptions requestOptions) Remove a user from all groups.removeUserFromGroupWithResponse
(String group, String userId, RequestOptions requestOptions) Remove a user from the target group.revokePermissionWithResponse
(WebPubSubPermission permission, String connectionId, RequestOptions requestOptions) Revoke permission for the connection.void
sendToAll
(String message, WebPubSubContentType contentType) Broadcast content inside request body to all the connected client connections.sendToAllWithResponse
(BinaryData message, RequestOptions requestOptions) Broadcast content inside request body to all the connected client connections.sendToAllWithResponse
(BinaryData message, WebPubSubContentType contentType, long contentLength, RequestOptions requestOptions) Broadcast content inside request body to all the connected client connections.void
sendToConnection
(String connectionId, String message, WebPubSubContentType contentType) Send content inside request body to the specific connection.sendToConnectionWithResponse
(String connectionId, BinaryData message, RequestOptions requestOptions) Send content inside request body to the specific connection.sendToConnectionWithResponse
(String connectionId, BinaryData message, WebPubSubContentType contentType, long contentLength, RequestOptions requestOptions) Send content inside request body to the specific connection.void
sendToGroup
(String group, String message, WebPubSubContentType contentType) Send content inside request body to a group of connections.sendToGroupWithResponse
(String group, BinaryData message, RequestOptions requestOptions) Send content inside request body to a group of connections.sendToGroupWithResponse
(String group, BinaryData message, WebPubSubContentType contentType, long contentLength, RequestOptions requestOptions) Send content inside request body to a group of connections.void
sendToUser
(String userId, String message, WebPubSubContentType contentType) Send content inside request body to the specific user.sendToUserWithResponse
(String userId, BinaryData message, RequestOptions requestOptions) Send content inside request body to the specific user.sendToUserWithResponse
(String userId, BinaryData message, WebPubSubContentType contentType, long contentLength, RequestOptions requestOptions) Send content inside request body to the specific user.userExistsWithResponse
(String userId, RequestOptions requestOptions) Check if there are any client connections connected for the given user.
-
Method Details
-
getClientAccessToken
Creates a client access token.- Parameters:
options
- Options to apply when creating the client access token.- Returns:
- A new client access instance.
-
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:
message
- The payload body.contentType
- Upload file type.contentLength
- The contentLength parameter.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
sendToAll
Broadcast content inside request body to all the connected client connections.- Parameters:
message
- The payload body.contentType
- Upload file type.- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
sendToAllWithResponse
Broadcast content inside request body to all the connected client connections.- Parameters:
message
- The payload body.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
connectionExistsWithResponse
public Response<Boolean> connectionExistsWithResponse(String connectionId, RequestOptions requestOptions) Check if the connection with the given connectionId exists.- Parameters:
connectionId
- The connection Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
closeConnectionWithResponse
public Response<Void> closeConnectionWithResponse(String connectionId, RequestOptions requestOptions) Close the client connection.- Parameters:
connectionId
- Target connection Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
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:
connectionId
- The connection Id.message
- The payload body.contentType
- Upload file type.contentLength
- The contentLength parameter.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
sendToConnection
Send content inside request body to the specific connection.- Parameters:
connectionId
- The connection Id.message
- The payload body.contentType
- Upload file type.- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
sendToConnectionWithResponse
public Response<Void> sendToConnectionWithResponse(String connectionId, BinaryData message, RequestOptions requestOptions) Send content inside request body to the specific connection.- Parameters:
connectionId
- The connection Id.message
- The payload body.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
groupExistsWithResponse
Check if there are any client connections inside the given group.- Parameters:
group
- Target group name, which length should be greater than 0 and less than 1025.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
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:
group
- Target group name, which length should be greater than 0 and less than 1025.message
- The payload body.contentType
- Upload file type.contentLength
- The contentLength parameter.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
sendToGroup
Send content inside request body to a group of connections.- Parameters:
group
- Target group name, which length should be greater than 0 and less than 1025.message
- The payload body.contentType
- Upload file type.- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
sendToGroupWithResponse
public Response<Void> sendToGroupWithResponse(String group, BinaryData message, RequestOptions requestOptions) Send content inside request body to a group of connections.- Parameters:
group
- Target group name, which length should be greater than 0 and less than 1025.message
- The payload body.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
addConnectionToGroupWithResponse
public Response<Void> addConnectionToGroupWithResponse(String group, String connectionId, RequestOptions requestOptions) Add a connection to the target group.- Parameters:
group
- Target group name, which length should be greater than 0 and less than 1025.connectionId
- Target connection Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
removeConnectionFromGroupWithResponse
public Response<Void> removeConnectionFromGroupWithResponse(String group, String connectionId, RequestOptions requestOptions) Remove a connection from the target group.- Parameters:
group
- Target group name, which length should be greater than 0 and less than 1025.connectionId
- Target connection Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
userExistsWithResponse
Check if there are any client connections connected for the given user.- Parameters:
userId
- Target user Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
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:
userId
- The user Id.message
- The payload body.contentType
- Upload file type.contentLength
- The contentLength parameter.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
sendToUser
Send content inside request body to the specific user.- Parameters:
userId
- The user Id.message
- The payload body.contentType
- Upload file type.- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
sendToUserWithResponse
public Response<Void> sendToUserWithResponse(String userId, BinaryData message, RequestOptions requestOptions) Send content inside request body to the specific user.- Parameters:
userId
- The user Id.message
- The payload body.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
addUserToGroupWithResponse
public Response<Void> addUserToGroupWithResponse(String group, String userId, RequestOptions requestOptions) Add a user to the target group.- Parameters:
group
- Target group name, which length should be greater than 0 and less than 1025.userId
- Target user Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
removeUserFromGroupWithResponse
public Response<Void> removeUserFromGroupWithResponse(String group, String userId, RequestOptions requestOptions) Remove a user from the target group.- Parameters:
group
- Target group name, which length should be greater than 0 and less than 1025.userId
- Target user Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
removeUserFromAllGroupsWithResponse
public Response<Void> removeUserFromAllGroupsWithResponse(String userId, RequestOptions requestOptions) Remove a user from all groups.- Parameters:
userId
- Target user Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
grantPermissionWithResponse
public Response<Void> grantPermissionWithResponse(WebPubSubPermission permission, String connectionId, RequestOptions requestOptions) Grant permission to the connection.- Parameters:
permission
- The permission: current supported actions are joinLeaveGroup and sendToGroup.connectionId
- Target connection Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
revokePermissionWithResponse
public Response<Void> revokePermissionWithResponse(WebPubSubPermission permission, String connectionId, RequestOptions requestOptions) Revoke permission for the connection.- Parameters:
permission
- The permission: current supported actions are joinLeaveGroup and sendToGroup.connectionId
- Target connection Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
checkPermissionWithResponse
public Response<Boolean> checkPermissionWithResponse(WebPubSubPermission permission, String connectionId, RequestOptions requestOptions) Check if a connection has permission to the specified action.- Parameters:
permission
- The permission: current supported actions are joinLeaveGroup and sendToGroup.connectionId
- Target connection Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
closeAllConnectionsWithResponse
Close the connections in the hub.Query Parameters
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:
requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
HttpResponseException
- thrown if status code is 400 or above, if throwOnError in requestOptions is not false.
-
closeGroupConnectionsWithResponse
public Response<Void> closeGroupConnectionsWithResponse(String group, RequestOptions requestOptions) Close connections in the specific group.Query Parameters
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:
group
- Target group name, which length should be greater than 0 and less than 1025.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
HttpResponseException
- thrown if status code is 400 or above, if throwOnError in requestOptions is not false.
-
closeUserConnectionsWithResponse
public Response<Void> closeUserConnectionsWithResponse(String userId, RequestOptions requestOptions) Close connections for the specific user.Query Parameters
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:
userId
- The user Id.requestOptions
- The options to configure the HTTP request before HTTP client sends it.- Returns:
- the response.
- Throws:
HttpResponseException
- thrown if status code is 400 or above, if throwOnError in requestOptions is not false.
-