This topic describes the integration solution and best practices for integrating Alibaba Cloud Workspace Cloud Phone.
Integration solution
The following figure shows the integration solution for Alibaba Cloud Workspace Cloud Phone:
The Alibaba Cloud Workspace server provides essential features, including instance, connection, key, and app management, which can be integrated with your server-side and client-side systems.
Your server integrates the Cloud Phone API to enable instance scheduling and user authentication.
Your client integrates Cloud Phone SDKs for Android and Windows. Once user authentication is completed, your client can utilize the Adaptive Streaming Protocol (ASP) to access cloud phones through Alibaba Cloud Workspace traffic gateways.
Best practices for server-side integration
During server-side integration, you must schedule instances, authenticate users, and expose APIs for clients to access. The following section describes the best practices for server-side integration.
Business model
Alibaba Cloud Workspace Cloud Phone introduces the concept of instance groups, enabling users to create multiple cloud phones within a single group. However, it is generally recommended to maintain a 1:1 ratio between instance groups and cloud phones. This means creating only one cloud phone per instance group to simplify operations like image changes.
Alibaba Cloud Workspace Cloud Phone also supports Cloud Phone Matrix, which is currently in an invitation-only beta phase. For purchase inquiries, please reach out to our sales team.
Instance scheduling
You are responsible for managing cloud phones under your Alibaba Cloud account, including the following tasks:
Instance creation: Create cloud phones as needed. This can be done manually in the Cloud Phone console or by calling CreateAndroidInstanceGroup.
Instance destruction: Destroy cloud phones when they are no longer required. This can be done manually in the Cloud Phone console or by calling DeleteAndroidInstanceGroup.
Instance pool maintenance:
When a client initiates a connection request, assign an idle cloud phone from the pool and mark it as "Used."
When the client disconnects from the cloud phone, return the cloud phone to the "Idle" state. Call the
RunCommandoperation to delete relevant files if necessary, to ensure no usage traces remain.
Instance pool status monitoring: Monitor the instance pool usage. If it reaches a threshold, such as 80%, trigger alerts and dynamically or manually scale up the pool.
Scheduling speed improvement: Ensure fast connections by anticipating peak business concurrency and maintaining sufficient available cloud phones for scheduling.
Account system integration & logon connection
Alibaba Cloud Workspace Cloud Phone supports the following logon methods:
Authorization-free logon (ticket-based mode): The authorization-free logon mode allows temporary end users to connect to cloud phones without requiring authorization. Only cloud phones created after you enable authorization-free logon support this method. To implement this, the integration party's server calls BatchGetAcpConnectionTicket to generate a ticket based on a unique user ID and cloud phone ID. This ticket must be passed to the client-side SDK to establish a connection to the target cloud phone.
Authorization-free logon (AuthCode mode): Once authorization-free logon is enabled, any unique string representing a user ID can obtain an AuthCode. By passing the AuthCode to the client-side SDK, end users can connect to any cloud phones under the current Alibaba Cloud account. The AuthCode becomes invalid after a single use. To connect again, a new AuthCode must be retrieved.
Since authorization-free logon offers greater flexibility and eliminates the need to maintain mapping relationships between business accounts and convenience accounts, we recommend that you adopt the authorization-free logon approach when you integrate Cloud Phone into your business system.
To enable authorization-free logon, submit a ticket and provide the UID of your Alibaba Cloud account.
Convenience account logon: This logon mode ensures trusted user access to cloud phones by leveraging the Elastic Desktop Service (EDS) account system and cloud phone access authorization. First, you need to create a convenience account in the EDS account system. Then, you must assign cloud phones to the authorized account. After the assignment is completed, end users can connect to any cloud phones under this convenience account through an Alibaba Cloud Workspace client. If end users want to connect to cloud phones over the client-side SDK by using a convenience account, call GetLoginToken to retrieve logon credentials including the logon token and session ID and pass these credentials to the client-side SDK.
User authorization and cloud phone connection (ticket-based authorization-free logon)
User authentication is part of the server-side integration process. To enable user connections to cloud phones, your backend must implement the following steps to generate an access ticket.
Cloud phone connection is part of the client-side integration process. You can establish the connection by passing the ticket to the client.
Query cloud phones: The server calls DescribeAndroidInstances to retrieve detailed instance information and obtain the ID (
AndroidInstanceId) of the cloud phone you want to connect to.Obtain a ticket: The server must prepare an end user ID (EndUserId) in advance. The end user ID can be any unique string. The server then calls BatchGetAcpConnectionTicket by using AndroidInstanceId and EndUserId to retrieve the connection ticket.
Initialize a session: Taking the web client as an example, the client initializes a session by calling
wuyingSdk.createSession().Establish a connection: Taking the web client as an example, the client calls
session.start()to establish a connection with the session.Disconnect: Taking the web client as an example, the client calls
session.stop()to disconnect from the session.
References
For more information about how to connect to cloud phones from different clients, see the following topics: