目录

About This Kit

Overview

Remote Communication Kit provides the following network data request functions:

Relevant Concepts

HTTP is short for Hypertext Transfer Protocol, which is a protocol used to transmit data between a client and a server. It operates on a client-server model where the client initiates requests and the server returns responses.

An HTTP request is a client-initiated message to a server, involving the following basic parts:

Request Method Description
GET Requests specific resources. Common scenario: obtaining resources such as webpages, images, and videos.
POST Submits resources, which are usually forms. Common scenario: submitting data, such as form data and files.
OPTIONS Obtains HTTP methods that a resource supports. Common scenario: obtaining the HTTP methods supported by a resource, for example, the request methods of an API.
HEAD Obtains the resource metadata, which functions similarly as the GET request, except that this method returns only metadata such as the response header. Common scenario: obtaining resource header information, such as the file size and modification time.
PUT Updates a resource that already exists on the server by completely replacing the resource at the specified path. Common scenario: updating a resource, such as modifying a file or database record.
DELETE Deletes a specified resource. Common scenario: deleting resources such as users and articles.
PATCH Updates a part of a resource. Common scenario: updating only a part of a specified resource on the server, for example, updating only some attributes and fields of a resource. This method does not replace the entire resource.

Supported HTTP Network Request Scenarios

Scenario Description Remarks
Sending PATCH requests Sends requests in PATCH mode. -
Setting the base URL of a session Prepends the base URL to the URL automatically in a session, unless the URL is an absolute one. -
Canceling automatic redirection Cancels automatic redirection of HTTP requests. -
Intercepting requests/responses Intercepts outgoing requests or incoming responses. -
Canceling requests Cancels a request before it is sent, when it is being sent, or after it is received. -
Caching responses Caches responses and preferentially reads from the cache during a request. The cache function takes effect when the corresponding process is started. The new cached data will replace the existing cached data.
Setting the response data type Sets the type in which data is returned, including string, object, and ArrayBuffer. By default, the response body type is ArrayBuffer. The caller can retrieve data as an object or string by using the toJSON or toString methods of Response.
Customizing certificate verification Customizes the logic of verifying client and server certificates for connection. -
Skipping SSL verification Skips SSL certificate verification for the server during SSL connection setup. -
Customizing DNS resolution Customizes a DNS server or configures static DNS rules. -
Capturing detailed tracing information Captures detailed tracing information in HTTP requests. This helps perform debugging, analyze performance, and gain insight into data flows during communication. -
Obtaining time-related information of HTTP requests Obtains the time-related information in each phase of an HTTP request. -

Constraints

This kit supports phones, 2-in-1 devices, tablets, and wearables. Starting from version 5.1.1(19), it is also supported on TVs, while it is temporarily unavailable for lite wearables.

Emulator Support

This kit supports the Emulator, but there are some differences in feature support between real devices and the Emulator: