WebPubSubServiceClient Class
WebPubSubServiceClient.
- Inheritance
-
azure.messaging.webpubsubservice._web_pub_sub_service_client.WebPubSubServiceClientWebPubSubServiceClient
Constructor
WebPubSubServiceClient(endpoint: str, hub: str, credential: Union[TokenCredential, AzureKeyCredential], **kwargs: Any)
Parameters
- hub
- str
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
- credential
- TokenCredential or AzureKeyCredential
Credential needed for the client to connect to Azure.
- api_version
- str
Api Version. The default value is "2021-10-01". Note that overriding this default value may result in unsupported behavior.
Methods
| from_connection_string |
Create a new WebPubSubServiceClient from a connection string. |
| get_client_access_token |
Build an authentication token. Example:
'baseUrl': 'wss://contoso.com/api/webpubsub/client/hubs/theHub', 'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ...', 'url': 'wss://contoso.com/api/webpubsub/client/hubs/theHub?access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ...' } |
from_connection_string
Create a new WebPubSubServiceClient from a connection string.
from_connection_string(connection_string: Type[ClientType], hub: str, **kwargs: str) -> ClientType
Parameters
- hub
- str
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.
- hub
Return type
get_client_access_token
Build an authentication token.
Example:
get_client_access_token() {
'baseUrl': 'wss://contoso.com/api/webpubsub/client/hubs/theHub', 'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ...', 'url': 'wss://contoso.com/api/webpubsub/client/hubs/theHub?access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ...'
}
get_client_access_token(**kwargs: Any) -> JSONType
Parameters
- user_id
- str
User Id.
- minutes_to_expire
- int
The expire time of the generated token.
- any] jwt_headers
- dict[<xref:str,>
Any headers you want to pass to jwt encoding.
Returns
JSON response containing the web socket endpoint, the token and a url with the generated access token.
Return type
Feedback
Submit and view feedback for