azure.messaging.webpubsubservice.aio.operations package

class azure.messaging.webpubsubservice.aio.operations.WebPubSubServiceClientOperationsMixin[source]
async add_connection_to_group(hub: str, group: str, connection_id: str, **kwargs: Any)None[source]

Add a connection to the target group.

Add a connection to the target group.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • group (str) – Target group name, which length should be greater than 0 and less than 1025.

  • connection_id (str) – Target connection Id.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async add_user_to_group(hub: str, group: str, user_id: str, **kwargs: Any)None[source]

Add a user to the target group.

Add a user to the target group.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • group (str) – Target group name, which length should be greater than 0 and less than 1025.

  • user_id (str) – Target user Id.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async check_permission(hub: str, permission: str, connection_id: str, *, target_name: Optional[str] = None, **kwargs: Any)None[source]

Check if a connection has permission to the specified action.

Check if a connection has permission to the specified action.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • permission (str) – The permission: current supported actions are joinLeaveGroup and sendToGroup. Possible values are: “sendToGroup” or “joinLeaveGroup”.

  • connection_id (str) – Target connection Id.

Keyword Arguments

target_name (str) – The meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async close_all_connections(hub: str, *, excluded: Optional[List[str]] = None, reason: Optional[str] = None, **kwargs: Any)None[source]

Close the connections in the hub.

Close the connections in the hub.

Parameters

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

Keyword Arguments
  • excluded (list[str]) – Exclude these connectionIds when closing the connections in the hub.

  • reason (str) – The reason closing the client connection.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async close_connection(hub: str, connection_id: str, *, reason: Optional[str] = None, **kwargs: Any)None[source]

Close the client connection.

Close the client connection.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • connection_id (str) – Target connection Id.

Keyword Arguments

reason (str) – The reason closing the client connection.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async close_group_connections(hub: str, group: str, *, excluded: Optional[List[str]] = None, reason: Optional[str] = None, **kwargs: Any)None[source]

Close connections in the specific group.

Close connections in the specific group.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • group (str) – Target group name, which length should be greater than 0 and less than 1025.

Keyword Arguments
  • excluded (list[str]) – Exclude these connectionIds when closing the connections in the group.

  • reason (str) – The reason closing the client connection.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async close_user_connections(hub: str, user_id: str, *, excluded: Optional[List[str]] = None, reason: Optional[str] = None, **kwargs: Any)None[source]

Close connections for the specific user.

Close connections for the specific user.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • user_id (str) – The user Id.

Keyword Arguments
  • excluded (list[str]) – Exclude these connectionIds when closing the connections for the user.

  • reason (str) – The reason closing the client connection.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async connection_exists(hub: str, connection_id: str, **kwargs: Any)None[source]

Check if the connection with the given connectionId exists.

Check if the connection with the given connectionId exists.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • connection_id (str) – The connection Id.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async generate_client_token(hub: str, *, user_id: Optional[str] = None, role: Optional[List[str]] = None, minutes_to_expire: Optional[int] = 60, **kwargs: Any)Any[source]

Generate token for the client to connect Azure Web PubSub service.

Generate token for the client to connect Azure Web PubSub service.

Parameters

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

Keyword Arguments
  • user_id (str) – User Id.

  • role (list[str]) – Roles that the connection with the generated token will have.

  • minutes_to_expire (int) – The expire time of the generated token.

Returns

JSON object

Return type

Any

Raises

~azure.core.exceptions.HttpResponseError

Example

# response body for status code(s): 200
response.json() == {
    "token": "str"  # Optional. The token value for the WebSocket client to connect to the service.
}
async grant_permission(hub: str, permission: str, connection_id: str, *, target_name: Optional[str] = None, **kwargs: Any)None[source]

Grant permission to the connection.

Grant permission to the connection.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • permission (str) – The permission: current supported actions are joinLeaveGroup and sendToGroup. Possible values are: “sendToGroup” or “joinLeaveGroup”.

  • connection_id (str) – Target connection Id.

Keyword Arguments

target_name (str) – The meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async group_exists(hub: str, group: str, **kwargs: Any)None[source]

Check if there are any client connections inside the given group.

Check if there are any client connections inside the given group.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • group (str) – Target group name, which length should be greater than 0 and less than 1025.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async remove_connection_from_group(hub: str, group: str, connection_id: str, **kwargs: Any)None[source]

Remove a connection from the target group.

Remove a connection from the target group.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • group (str) – Target group name, which length should be greater than 0 and less than 1025.

  • connection_id (str) – Target connection Id.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async remove_user_from_all_groups(hub: str, user_id: str, **kwargs: Any)None[source]

Remove a user from all groups.

Remove a user from all groups.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • user_id (str) – Target user Id.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async remove_user_from_group(hub: str, group: str, user_id: str, **kwargs: Any)None[source]

Remove a user from the target group.

Remove a user from the target group.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • group (str) – Target group name, which length should be greater than 0 and less than 1025.

  • user_id (str) – Target user Id.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async revoke_permission(hub: str, permission: str, connection_id: str, *, target_name: Optional[str] = None, **kwargs: Any)None[source]

Revoke permission for the connection.

Revoke permission for the connection.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • permission (str) – The permission: current supported actions are joinLeaveGroup and sendToGroup. Possible values are: “sendToGroup” or “joinLeaveGroup”.

  • connection_id (str) – Target connection Id.

Keyword Arguments

target_name (str) – The meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async send_to_all(hub: str, message: Union[IO, str], *, excluded: Optional[List[str]] = None, **kwargs: Any)None[source]

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

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

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • message (IO or str) – The payload body.

Keyword Arguments
  • excluded (list[str]) – Excluded connection Ids.

  • content_type (str) – Media type of the body sent to the API. Default value is “application/json”. Allowed values are: “application/json”, “application/octet-stream”, “text/plain.”

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async send_to_connection(hub: str, connection_id: str, message: Union[IO, str], **kwargs: Any)None[source]

Send content inside request body to the specific connection.

Send content inside request body to the specific connection.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • connection_id (str) – The connection Id.

  • message (IO or str) – The payload body.

Keyword Arguments

content_type (str) – Media type of the body sent to the API. Default value is “application/json”. Allowed values are: “application/json”, “application/octet-stream”, “text/plain.”

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async send_to_group(hub: str, group: str, message: Union[IO, str], *, excluded: Optional[List[str]] = None, **kwargs: Any)None[source]

Send content inside request body to a group of connections.

Send content inside request body to a group of connections.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • group (str) – Target group name, which length should be greater than 0 and less than 1025.

  • message (IO or str) – The payload body.

Keyword Arguments
  • excluded (list[str]) – Excluded connection Ids.

  • content_type (str) – Media type of the body sent to the API. Default value is “application/json”. Allowed values are: “application/json”, “application/octet-stream”, “text/plain.”

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async send_to_user(hub: str, user_id: str, message: Union[IO, str], **kwargs: Any)None[source]

Send content inside request body to the specific user.

Send content inside request body to the specific user.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • user_id (str) – The user Id.

  • message (IO or str) – The payload body.

Keyword Arguments

content_type (str) – Media type of the body sent to the API. Default value is “application/json”. Allowed values are: “application/json”, “application/octet-stream”, “text/plain.”

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async user_exists(hub: str, user_id: str, **kwargs: Any)None[source]

Check if there are any client connections connected for the given user.

Check if there are any client connections connected for the given user.

Parameters
  • hub (str) – Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.

  • user_id (str) – Target user Id.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError