WebPubSubServiceClientOperationsMixin Class

Inheritance
builtins.object
WebPubSubServiceClientOperationsMixin

Constructor

WebPubSubServiceClientOperationsMixin()

Methods

add_connection_to_group

Add a connection to the target group.

Add a connection to the target group.

add_user_to_group

Add a user to the target group.

Add a user to the target group.

check_permission

Check if a connection has permission to the specified action.

Check if a connection has permission to the specified action.

close_all_connections

Close the connections in the hub.

Close the connections in the hub.

close_connection

Close the client connection.

Close the client connection.

close_group_connections

Close connections in the specific group.

Close connections in the specific group.

close_user_connections

Close connections for the specific user.

Close connections for the specific user.

connection_exists

Check if the connection with the given connectionId exists.

Check if the connection with the given connectionId exists.

generate_client_token

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

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

grant_permission

Grant permission to the connection.

Grant permission to the connection.

group_exists

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

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

remove_connection_from_group

Remove a connection from the target group.

Remove a connection from the target group.

remove_user_from_all_groups

Remove a user from all groups.

Remove a user from all groups.

remove_user_from_group

Remove a user from the target group.

Remove a user from the target group.

revoke_permission

Revoke permission for the connection.

Revoke permission for the connection.

send_to_all

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

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

send_to_connection

Send content inside request body to the specific connection.

Send content inside request body to the specific connection.

send_to_group

Send content inside request body to a group of connections.

Send content inside request body to a group of connections.

send_to_user

Send content inside request body to the specific user.

Send content inside request body to the specific user.

user_exists

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

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

add_connection_to_group

Add a connection to the target group.

Add a connection to the target group.

async add_connection_to_group(hub: str, group: str, connection_id: str, **kwargs: Any) -> None

Parameters

hub
str
Required

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

group
str
Required

Target group name, which length should be greater than 0 and less than 1025.

connection_id
str
Required

Target connection Id.

Returns

None

Return type

Exceptions

add_user_to_group

Add a user to the target group.

Add a user to the target group.

async add_user_to_group(hub: str, group: str, user_id: str, **kwargs: Any) -> None

Parameters

hub
str
Required

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

group
str
Required

Target group name, which length should be greater than 0 and less than 1025.

user_id
str
Required

Target user Id.

Returns

None

Return type

Exceptions

check_permission

Check if a connection has permission to the specified action.

Check if a connection has permission to the specified action.

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

Parameters

hub
str
Required

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

permission
str
Required

The permission: current supported actions are joinLeaveGroup and sendToGroup. Possible values are: "sendToGroup" or "joinLeaveGroup".

connection_id
str
Required

Target connection Id.

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

Exceptions

close_all_connections

Close the connections in the hub.

Close the connections in the hub.

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

Parameters

hub
str
Required

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

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

Exceptions

close_connection

Close the client connection.

Close the client connection.

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

Parameters

hub
str
Required

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

connection_id
str
Required

Target connection Id.

reason
str

The reason closing the client connection.

Returns

None

Return type

Exceptions

close_group_connections

Close connections in the specific group.

Close connections in the specific group.

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

Parameters

hub
str
Required

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

group
str
Required

Target group name, which length should be greater than 0 and less than 1025.

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

Exceptions

close_user_connections

Close connections for the specific user.

Close connections for the specific user.

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

Parameters

hub
str
Required

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

user_id
str
Required

The user Id.

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

Exceptions

connection_exists

Check if the connection with the given connectionId exists.

Check if the connection with the given connectionId exists.

async connection_exists(hub: str, connection_id: str, **kwargs: Any) -> None

Parameters

hub
str
Required

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

connection_id
str
Required

The connection Id.

Returns

None

Return type

Exceptions

generate_client_token

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

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

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

Parameters

hub
str
Required

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

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

<xref:Any>

Exceptions

Examples


   # response body for status code(s): 200
   response.json() == {
       "token": "str"  # Optional. The token value for the WebSocket client to connect to the service.
   }

grant_permission

Grant permission to the connection.

Grant permission to the connection.

async grant_permission(hub: str, permission: str, connection_id: str, *, target_name: Optional[str] = None, **kwargs: Any) -> None

Parameters

hub
str
Required

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

permission
str
Required

The permission: current supported actions are joinLeaveGroup and sendToGroup. Possible values are: "sendToGroup" or "joinLeaveGroup".

connection_id
str
Required

Target connection Id.

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

Exceptions

group_exists

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

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

async group_exists(hub: str, group: str, **kwargs: Any) -> None

Parameters

hub
str
Required

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

group
str
Required

Target group name, which length should be greater than 0 and less than 1025.

Returns

None

Return type

Exceptions

remove_connection_from_group

Remove a connection from the target group.

Remove a connection from the target group.

async remove_connection_from_group(hub: str, group: str, connection_id: str, **kwargs: Any) -> None

Parameters

hub
str
Required

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

group
str
Required

Target group name, which length should be greater than 0 and less than 1025.

connection_id
str
Required

Target connection Id.

Returns

None

Return type

Exceptions

remove_user_from_all_groups

Remove a user from all groups.

Remove a user from all groups.

async remove_user_from_all_groups(hub: str, user_id: str, **kwargs: Any) -> None

Parameters

hub
str
Required

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

user_id
str
Required

Target user Id.

Returns

None

Return type

Exceptions

remove_user_from_group

Remove a user from the target group.

Remove a user from the target group.

async remove_user_from_group(hub: str, group: str, user_id: str, **kwargs: Any) -> None

Parameters

hub
str
Required

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

group
str
Required

Target group name, which length should be greater than 0 and less than 1025.

user_id
str
Required

Target user Id.

Returns

None

Return type

Exceptions

revoke_permission

Revoke permission for the connection.

Revoke permission for the connection.

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

Parameters

hub
str
Required

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

permission
str
Required

The permission: current supported actions are joinLeaveGroup and sendToGroup. Possible values are: "sendToGroup" or "joinLeaveGroup".

connection_id
str
Required

Target connection Id.

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

Exceptions

send_to_all

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

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

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

Parameters

hub
str
Required

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

message
<xref:IO> or str
Required

The payload body.

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

Exceptions

send_to_connection

Send content inside request body to the specific connection.

Send content inside request body to the specific connection.

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

Parameters

hub
str
Required

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

connection_id
str
Required

The connection Id.

message
<xref:IO> or str
Required

The payload body.

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

Exceptions

send_to_group

Send content inside request body to a group of connections.

Send content inside request body to a group of connections.

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

Parameters

hub
str
Required

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

group
str
Required

Target group name, which length should be greater than 0 and less than 1025.

message
<xref:IO> or str
Required

The payload body.

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

Exceptions

send_to_user

Send content inside request body to the specific user.

Send content inside request body to the specific user.

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

Parameters

hub
str
Required

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

user_id
str
Required

The user Id.

message
<xref:IO> or str
Required

The payload body.

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

Exceptions

user_exists

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

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

async user_exists(hub: str, user_id: str, **kwargs: Any) -> None

Parameters

hub
str
Required

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

user_id
str
Required

Target user Id.

Returns

None

Return type

Exceptions