CN112631592A - Data request method, device, equipment, medium and program product - Google Patents

Data request method, device, equipment, medium and program product Download PDF

Info

Publication number
CN112631592A
CN112631592A CN202011643321.5A CN202011643321A CN112631592A CN 112631592 A CN112631592 A CN 112631592A CN 202011643321 A CN202011643321 A CN 202011643321A CN 112631592 A CN112631592 A CN 112631592A
Authority
CN
China
Prior art keywords
protocol
target
data request
channel
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011643321.5A
Other languages
Chinese (zh)
Inventor
贾正权
漆昱恒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Youzhuju Network Technology Co Ltd
Original Assignee
Beijing Youzhuju Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Youzhuju Network Technology Co Ltd filed Critical Beijing Youzhuju Network Technology Co Ltd
Priority to CN202011643321.5A priority Critical patent/CN112631592A/en
Publication of CN112631592A publication Critical patent/CN112631592A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)

Abstract

According to the data request method, the data request device, the data request equipment, the data request media and the program product, firstly, an environment feature identifier of a data request end is determined according to an acquired page rendering instruction, then, a target channel and a target protocol which meet preset efficiency conditions are determined according to the environment feature identifier, and finally, rendering data of a target page are acquired through the target channel and the target protocol. The embodiment of the disclosure identifies whether the data request terminal is a front-end application or a back-end service program through the environment feature identifier, and then fully utilizes all transmission protocols in the front end and the back end, and selects the transmission protocol in which the transmission efficiency meets the preset efficiency condition, so as to solve the technical problems that the data request transmission efficiency is low and the application program performance is limited because the data request terminal and the request processing terminal adopt the same transmission protocol in the prior art. The technical effects of improving the transmission efficiency of the data request and greatly improving the overall performance of the application program are achieved.

Description

Data request method, device, equipment, medium and program product
Technical Field
Embodiments of the present disclosure relate to the field of computer and network communication technologies, and in particular, to a data request method, apparatus, device, medium, and program product.
Background
Rendering of a Web page is generally divided into two modes, namely front-end rendering and back-end rendering, and either mode needs to send a data request to acquire rendering data to complete rendering of the Web page. The data request terminals of different rendering modes are different from each other, and the data request terminals can be made by a front-end application or a back-end server.
At present, in the prior art, a common data request end and a request processing end adopt the same transmission protocol to transmit rendering data. However, with the continuous development of internet technology, the data request end and the request processing end can support a plurality of transmission protocols, and with the continuous updating and expansion of the transmission protocols, the new data transmission protocol can complete the data transmission task more simply and efficiently.
Therefore, in the prior art, the data request end and the request processing end adopt the same transmission protocol to transmit rendering data, so that the resource advantages of the processing system of each request link cannot be fully utilized, and the technical problems of low data request transmission efficiency and limited application program performance are caused.
Disclosure of Invention
The disclosed embodiments provide a data request method, device, equipment, medium and program product, so as to solve the technical problems in the prior art that a data request end and a request processing end adopt the same transmission protocol, so that the data request transmission efficiency is low and the application program performance is limited.
In a first aspect, an embodiment of the present disclosure provides a data request method, including:
determining an environment feature identifier of a data request end according to an acquired page rendering instruction, wherein the page rendering instruction is used for triggering display of a target page, and the environment feature identifier is used for representing an application environment type corresponding to the data request end;
determining a target channel and a target protocol according to the environment characteristic identification and a preset efficiency condition;
and acquiring rendering data of the target page through the target channel and the target protocol.
In a second aspect, an embodiment of the present disclosure provides a data request apparatus, including:
the acquisition module is used for acquiring a page rendering instruction;
the processing module is used for determining an environment feature identifier of the data request end according to a page rendering instruction, the page rendering instruction is used for triggering display of a target page, and the environment feature identifier is used for representing an application environment type corresponding to the data request end;
the processing module is also used for determining a target channel and a target protocol which meet the preset efficiency condition according to the environment characteristic identification;
and the acquisition module is also used for acquiring the rendering data of the target page through the target channel and the target protocol.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
at least one processor and memory;
the memory stores a computer program;
the at least one processor executes the computer program stored by the memory such that the at least one processor performs the data request method as described above in the first aspect and various possible designs of the first aspect.
In a fourth aspect, the embodiments of the present disclosure provide a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the data request method according to the first aspect and various possible designs of the first aspect are implemented.
In a fifth aspect, embodiments of the present disclosure provide a computer program product comprising a computer program that, when executed by a processor, implements the data request method as described above in the first aspect and various possible designs of the first aspect.
According to the data request method, the data request device, the data request equipment, the data request media and the program product, firstly, an environment feature identifier of a data request end is determined according to an acquired page rendering instruction, then, a target channel and a target protocol which meet preset efficiency conditions are determined according to the environment feature identifier, and finally, rendering data of a target page are acquired through the target channel and the target protocol. The embodiment of the disclosure identifies whether the data request terminal is a front-end application or a back-end service program through the environment feature identifier, and then fully utilizes all transmission protocols in the front end and the back end, and selects the transmission protocol in which the transmission efficiency meets the preset efficiency condition, so as to solve the technical problems that the data request transmission efficiency is low and the application program performance is limited because the data request terminal and the request processing terminal adopt the same transmission protocol in the prior art. The technical effects of improving the transmission efficiency of the data request and greatly improving the overall performance of the application program are achieved.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained according to the drawings without inventive exercise.
1a-1b are logic diagrams of Web page rendering provided by embodiments of the present disclosure;
fig. 2 is a first flowchart illustrating a data request method according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart illustrating a second data request method according to an embodiment of the disclosure;
fig. 4 is a third schematic flowchart of a data request method according to an embodiment of the present disclosure;
fig. 5 is a block diagram of a data request apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments, including but not limited to combinations of embodiments, which can be derived by one of ordinary skill in the art from the embodiments disclosed herein without making any inventive step are within the scope of the present disclosure.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present disclosure and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Rendering of Web pages is generally divided into two modes, front-end rendering and back-end rendering:
the front-end rendering refers to that a browser or other application programs such as short video playing software located in the front-end system initiates a data request to the back-end service system, the back-end service system returns relevant information data for Web page rendering to the front-end system according to the data request, and the browser or other application programs of the front-end system render and display the final Web page.
Referring to fig. 1a-1b, fig. 1a-1b are logic diagrams of Web page rendering provided by an embodiment of the present disclosure. Fig. 1a is a logic diagram of front-end rendering, a user obtains a page rendering instruction after operating on an application interface or an operation interface 101, and transmits the page rendering instruction to a front-end system 102, the front-end system 102 generates a data request and transmits the data request to a back-end service system 103, and the back-end service system 103 returns relevant data for rendering to the front-end system 102 to perform rendering and display of a Web page.
It should be noted that the back-end service system 103 may include a plurality of servers and databases, and the back-end service system generally generates corresponding data request services or processes after receiving the data request of the front-end system 102, so as to retrieve the related rendering data from each distributed server and database.
And the back-end rendering refers to sending a rendering request of the Web page to a back-end service system by a browser or other application programs of the front-end system, and then the back-end service system generates a data request according to the rendering request so as to render and combine the content, the template frame, the diagram and other information corresponding to the Web page and return the rendered Web page to the browser or other application programs of the front-end system for display.
Fig. 1b is a logic diagram of back-end rendering, where a user operates an application interface or an operation interface 101 to obtain a page rendering instruction, and transmits the page rendering instruction to a front-end system 102, the front-end system 102 generates a rendered Web page request and transmits the rendered Web page request to a back-end service system 103, the back-end service system 103 sends a corresponding data call request to a database according to the rendered Web page request, and then renders and assembles rendered data into Web page display data, and returns the Web page display data to the front-end system 102 for displaying a Web page.
As can be seen from the two rendering modes, either mode can involve data interaction requests of a front-end system and a back-end system. In the prior art, a data request is generally processed by using a homogeneous request, for example, a browser or other application program of a front-end system initiates the data request by using a hypertext Transfer protocol (HTTP), and then a back-end service system sends or responds the data request by using the HTTP.
Isomorphic requests are a form of inertial thinking and conventional means for those skilled in the art, as such the same protocol statements may be referenced when the code is implemented. It can be understood that this is a simple and trouble-saving development process. However, with the development of internet technology, a more efficient new mode or new protocol suitable for different systems appears in a data request mode or protocol, and at this time, various protocols or modes provided in a system environment cannot be well utilized by a homogeneous request processing mode, so that the data transmission efficiency of a browser or other application programs is affected, and the overall performance of the programs is limited.
In the prior art, a processing mode of a newly-appeared protocol such as an RPC (Remote Procedure Call) protocol is to perform point-to-point conversion between an old protocol such as an HTTP protocol and a new protocol such as an RPC protocol, that is, the HTTP protocol is correspondingly converted into the RPC protocol. Although the application of the new protocol is realized, only the conversion of the specific protocol can be realized, if developers of a browser or other application programs cannot foresee the type of the protocol supported by the system environment (a front-end system or a back-end service system) where the application is located, the peer-to-peer protocol conversion cannot be realized, or the front-end system or the back-end service system is prompted to lack the corresponding protocol, and a user is required to correspondingly update the front-end system or the back-end service system. And for the old software, it is certainly impossible to foresee the later emerging protocol type, and therefore, the data transmission by using the more efficient protocol is not available.
Based on the technical problems, the invention idea of the application aims to:
by defining a new data request method, whether a system initiating a data request is a front-end system or a back-end service system is automatically identified, and one protocol or a combination of protocols with the highest efficiency for overall data transmission is automatically selected to transmit data according to various data transmission protocols supported in each system. The method can be loaded to a browser or other application programs of a front-end system as an external relying program or loaded to a back-end service system, and one or more protocols with the highest efficiency of transmitting corresponding data requests in a data request end are automatically selected when the data requests are found. Therefore, the resources of the multi-protocol system are fully utilized, developers do not need to independently write interface programs for mutual conversion of all protocols in the application programs, and the overall performance of the application can be greatly improved without greatly changing the application programs.
The data request method provided by the present application is described in detail below with reference to the accompanying drawings.
Referring to fig. 2, fig. 2 is a first schematic flowchart of a data request method according to an embodiment of the present disclosure. The method of the embodiment is applied to terminal equipment and/or a server at a user side, and the data request method comprises the following steps:
s201: and determining the environment characteristic identification of the data request terminal according to the acquired page rendering instruction.
In this step, the page rendering instruction is used to trigger the display of the target page, and the environment feature identifier is used to characterize the application environment type corresponding to the data request end, such as whether the data request end is an application program of the front-end system or a service program or a process in the back-end service system.
In this embodiment, the environment feature identifier includes a front-end application identifier, where the front-end application identifier is used to characterize the data request end as a front-end application program, and the front-end application program is used to render the target page by using the rendering data; in addition, in a possible implementation manner, the environment feature identifier further includes a back-end application identifier, where the back-end application identifier is used to represent that the data request end is a back-end service program, and the back-end service program is used to render the target page in the back-end system by using the rendering data, and return the target page to the front-end application program for display.
That is, the data request method provided by the embodiment of the disclosure can be applied to a front-end application program corresponding to the front-end system, such as a browser, or other application programs, such as a short video playing program, and can also be applied to a back-end service program or a process corresponding to the back-end service system. It is therefore necessary to first identify the specific application environment by the environment feature identification.
For example, a JavaScript program framework can be applied to both a front-end system and a back-end service system, where a specification framework of web.js is applied to the front-end system, and a specification framework of server.js is applied to the back-end service system, and when the application is applied to different environments, an application tag needs to be given in a form of a head environment declaration in a specific program, for example, JS (JavaScript) is introduced into a browser to use a < script > tag, JS is introduced into SSJS (Server-Side JavaScript, JS on the service Side) at that time, and the < Server > tag is used.
It should be noted that JavaScript (often abbreviated as JS) is a high-level, interpreted programming language; the method is a language based on prototype and function advance, is a multi-paradigm language, supports object-oriented programming, command programming and functional programming, and can add dynamic effects to pages.
In a possible implementation manner, when the target page is displayed on a non-browser application of the front-end system, the step specifically includes:
acquiring an operation instruction of a user on an application program interface; determining the page rendering instruction according to the operation instruction; and determining the environment feature identification according to the page rendering instruction.
That is, as long as the tracker or the tracking process captures the operation corresponding to the user, i.e., the operation instruction, and recognizes that the operation instruction corresponds to the page rendering instruction, it is necessary to first determine whether the target page needs the front-end system to complete the rendering or the back-end service system to complete the rendering, which is to determine the environment feature identifier. When the data request method of the embodiment of the disclosure is used as an external dependent program, a program developer can automatically identify the environment feature identifier corresponding to the front end or the back end without considering a specific application environment.
In another possible implementation manner, when the target page is displayed on a browser of the front-end system, the step specifically includes:
acquiring an operation instruction of a user on a browser interface;
determining a first data request according to the operation instruction and a native interface of the browser;
parsing the first data request through an external data interface to determine the page rendering instruction;
and determining the environment feature identification according to the page rendering instruction.
The data request method of the embodiment of the disclosure, as an external dependent program, can avoid the program change of the browser to the maximum extent, so that the native data request interface of the browser is reserved, and after the native interface sends out the first data request, the first data request is reversely analyzed to obtain the page rendering instruction.
S202: and determining a target channel and a target protocol according to the environment characteristic identification and the preset efficiency condition.
In this step, the target channel is an execution object for sending a request, such as sending the request through a native API interface of a browser, or sending the request through a connection bridge module of an application program, such as JSBridge, and the target protocol is used for organizing a transfer mode of the request, such as a hypertext transfer protocol (HTTP) protocol or a remote call protocol (RPC) protocol.
In this embodiment, the method specifically includes:
if the application environment type is determined to be the front-end application identifier according to the environment characteristic identifier, screening a target channel and a target protocol which meet a preset efficiency condition from each channel to be selected and the protocol to be selected according to the front-end application identifier;
and if the application environment type is determined to be the back-end application identifier according to the environment characteristic identifier, screening a target channel and a target protocol which meet a preset efficiency condition from each channel to be selected and the protocol to be selected according to the back-end application identifier.
It should be noted that, in this embodiment, the preset efficiency condition includes that a protocol with the highest transmission efficiency is screened out from all protocols supported by the data request end. It is to be understood that the predetermined efficiency condition may further include a protocol having a ranking greater than or equal to a predetermined ranking threshold when ranked by transmission efficiency. The transmission efficiency of each protocol may be different for different application environments, and the real-time transmission efficiency of each protocol may be dynamically detected by using an efficiency detection model. Furthermore, the data transmission protocol can be selected by comprehensively considering the operation resource consumption of the protocol.
For example, the front-end application is identified as a Web scene such as Web. The method corresponds to a plurality of to-be-selected channels in a Web scene and comprises the following steps: browser and non-browser applications such as short video playback programs. Js sends HTTP requests within the browser environment through a native interface API, such as xmlhttrequest or fetch, or js can send HTTP requests using the browser native interface API or JSBridge of an application in the Webview scenario of the application. In the server scenario, server.js initiates an HTTP request or an RPC call on the server side using a server-side voice, e.g., node.js' HTTP module.
It should be noted that JSBridge mainly provides JavaScript with an interface for invoking Native functions, so that the front-end part in hybrid development can conveniently use Native functions (e.g., address location, camera). JSbridge is a bridge between Native and non-Native, and the core of the JSbridge is to construct a channel for message communication between Native and non-Native, and the communication channel is bidirectional. In the design of the JSBridge, a front end can be regarded as a client of the RPC, and a Native end can be regarded as a server of the RPC, so that the main logic of the JSBridge to be realized appears: a communication call (Native and JS communication) and a handle resolution call.
S203: and acquiring rendering data of the target page through the target channel and the target protocol.
In this step, the target channel sends a data request transmitted according to the target protocol, and receives rendering data returned by the data request processing terminal.
According to the data request method provided by the embodiment of the disclosure, firstly, the environment feature identification of the data request end is determined according to the acquired page rendering instruction, then, the target channel and the target protocol which meet the preset efficiency condition are determined according to the environment feature identification, and finally, the rendering data of the target page are acquired through the target channel and the target protocol. The embodiment of the disclosure identifies whether the data request terminal is a front-end application or a back-end service program through the environment feature identifier, and then fully utilizes all transmission protocols in the front end and the back end, and selects the transmission protocol in which the transmission efficiency meets the preset efficiency condition, so as to solve the technical problems that the data request transmission efficiency is low and the application program performance is limited because the data request terminal and the request processing terminal adopt the same transmission protocol in the prior art. The technical effects of improving the transmission efficiency of the data request and greatly improving the overall performance of the application program are achieved.
Referring to fig. 3, fig. 3 is a schematic flowchart illustrating a data request method according to an embodiment of the disclosure. The method of the embodiment is applied to terminal equipment and/or a server at a user side, and the data request method comprises the following steps:
s301: and determining the environment characteristic identification of the data request terminal according to the acquired page rendering instruction.
In this embodiment, the environment feature identifier includes: a front-end application identifier and a back-end application identifier. The front-end application identifier is used for representing that the data request end is a front-end application program, the front-end application program is used for rendering the target page by using the rendering data, the back-end application identifier is used for representing that the data request end is a back-end service program, and the back-end service program is used for rendering the target page by using the rendering data in a back-end system and returning the target page to the front-end application program for display.
S302: and judging the application environment type corresponding to the data request terminal according to the environment characteristics.
In this step, if the application environment type is determined to be the front-end application identifier according to the environment feature identifier, step S303 is executed, and if the application environment type is determined to be the back-end application identifier according to the environment feature identifier, step S304 is executed.
S303: and screening target channels and target protocols which meet preset efficiency conditions from all channels to be selected and protocols to be selected according to the front-end application identification.
In this step, the candidate channel corresponding to the front-end application identifier includes: browser environment channel and application APP environment channel. The browser environment channel comprises a first path and/or a second path, wherein the first path comprises an XMLHttpRequest method instruction, and the second path comprises a Fetch method instruction; the APP environment channel comprises an application program connecting bridge, and the application program connecting bridge comprises JSbridge method instructions; the candidate protocol comprises the following steps: the HTTP protocol and the RPC protocol.
Specifically, when the data request terminal is a browser and the browser directly initiates a target page rendering request:
s3031: and determining that the target channel is a first path and/or a second path of the browser environment channel according to the front-end application identifier, and the target protocol is an HTTP protocol.
For example, the above-mentioned manner includes three implementation forms:
first, the browser sends the HTTP request using the XMLHttpRequest method in the first path using a browser native interface API in the browser channel.
Second, the browser sends the HTTP request using the browser native interface API in the browser channel using the Fetch method in the second path.
Thirdly, when the target page comprises a plurality of sub-pages, each sub-page can actually select a different path, for example, a first sub-page selects an XMLHttpRequest method in a first path to send an HTTP request, and a second sub-page selects a Fetch method in a second path to send the HTTP request.
When the data request terminal is an application program of a non-browser on the user terminal and the application program initiates a target page rendering request:
s3032: and determining that the target channel is a first path and/or a second path of a native interface of the browser and/or an application program connection bridge according to the front-end application identification, and the target protocol is an HTTP protocol.
For example, the above-mentioned manner includes 7 implementation forms:
(1) the front-end system calls a native interface of the browser to send the HTTP request by using a first path;
(2) the front-end system calls a native interface of the browser to send the HTTP request by using a second path;
(3) the front-end system calls a connection bridge of a non-browser application program, such as a JSbridge method, to send an HTTP request;
(4) when the target page comprises a plurality of sub-pages, each sub-page can also select different paths, for example, a first sub-page selects an XMLHttpRequest method in a first path to send an HTTP request, and a second sub-page selects a Fetch method in a second path to send the HTTP request.
(5) When the target page comprises a plurality of sub-pages, each sub-page can also select different paths, for example, a first sub-page selects an XMLHttpRequest method in the first path to send the HTTP request, and a second sub-page selects a connecting bridge of a non-browser application program, such as a JSbridge method, to send the HTTP request.
(6) When the target page comprises a plurality of sub-pages, each sub-page can also select different paths, for example, the first sub-page selects a Fetch method in the second path to send the HTTP request, and the second sub-page selects a connecting bridge of a non-browser application program, such as a JSbridge method to send the HTTP request.
(7) When the target page comprises a plurality of sub-pages, each sub-page can actually select different paths, for example, a first sub-page selects an XMLHttpRequest method in a first path to send an HTTP request, a second sub-page selects a Fetch method in a second path to send the HTTP request, and a third sub-page selects a connecting bridge of a non-browser application such as a JSbridge method to send the HTTP request.
It should be noted that, the above 7 ways mean that the user triggers a rendering instruction of a Web page, i.e. a target page, on the operation interface of the non-browser application, and then the front-end system can select to invoke a browser channel or an application channel to send a data request organized according to a target protocol.
S304: and screening target channels and target protocols which meet preset efficiency conditions from all channels to be selected and protocols to be selected according to the back-end application identification.
In the step, the target channel is determined as a back-end service channel according to the back-end application identifier; if the back-end service program supports the RPC protocol, the target protocol is the RPC protocol, otherwise, the target protocol is the HTTP protocol.
S305: and acquiring rendering data of the target page through the target channel and the target protocol.
The present step is a subsequent step corresponding to S303 and S304, and can be divided into three sub-steps, which correspond to S3031, S3032 and S304 respectively. Specifically, the method comprises the following steps:
s3051: and sending an HTTP request through the first path and/or the second path and an HTTP protocol to acquire rendering data.
In this step, three implementation manners in S3031 are specifically corresponded. The rendering data is obtained according to the corresponding channel, path, i.e. target protocol, which is not described herein again.
S3052: and sending an HTTP request through the first path and/or the second path and/or the application program connection bridge and the HTTP protocol to acquire rendering data.
In this step, seven implementation manners in S3032 are specifically corresponded. The rendering data is obtained according to the corresponding channel, path, i.e. target protocol, which is not described herein again.
For ease of understanding, specific examples for steps S3031-S3051 and S3032-S3052 are as follows:
js, for example, the front-end application identifier is a Web scene, such as Web, and corresponds to a plurality of to-be-gated channels in the Web scene, including: browser and non-browser applications such as short video playback programs. Js sends HTTP requests within the browser environment through a native interface API, such as xmlhttrequest or fetch, to get rendering data.
Js may send HTTP requests using browser native interface API or JSBridge of an application in a Webview scenario of a non-browser application. In a server-side scenario, server.js initiates an HTTP request or an RPC call to obtain rendering data on a server side using a server-side voice, such as a node.js HTTP module.
S3053: and setting a target channel and a target protocol in a configuration component of the external data interface to acquire rendering data.
In this step, specifically corresponding to the data request manner in S304, the configuration component is a configuration component in a Uniform Resource Locator (URL) that is obtained by an external data interface.
For example: in the exposed foreign data interface, the relative URL of the incoming interface, such as/profile/userinfo, can set whether to use HTTP request or RPC in options, if it is HTTP call the URL of the final resource will become HTTPs:// do in. Compared with directly initiating an HTTP request, the final resource URL is similar to a Consul:// p.s.m/profile/userinfo when the RPC is called, the RPC can avoid links such as DNS analysis and the like and realize service calling in the same machine room, and the request delay can be greatly shortened.
According to the data request method provided by the embodiment of the disclosure, firstly, the environment feature identification of the data request end is determined according to the acquired page rendering instruction, then, the target channel and the target protocol which meet the preset efficiency condition are determined according to the environment feature identification, and finally, the rendering data of the target page are acquired through the target channel and the target protocol. The embodiment of the disclosure identifies whether the data request terminal is a front-end application or a back-end service program through the environment feature identifier, and then fully utilizes all transmission protocols in the front end and the back end, and selects the transmission protocol in which the transmission efficiency meets the preset efficiency condition, so as to solve the technical problems that the data request transmission efficiency is low and the application program performance is limited because the data request terminal and the request processing terminal adopt the same transmission protocol in the prior art. The technical effects of improving the transmission efficiency of the data request and greatly improving the overall performance of the application program are achieved.
Referring to fig. 4, fig. 4 is a third schematic flowchart of a data request method according to an embodiment of the present disclosure. The method of the embodiment is applied to terminal equipment and/or a server at a user side, and the data request method comprises the following steps:
s401: and determining each data request protocol supported by the data request end and the request processing end according to the application environment of the data request end.
The step is that a browser or a non-browser application program in a front-end system or a back-end service system needs to search and confirm each data request protocol supported by a data request end and a request processing end when a data request needs to be initiated for the first time.
S402: and establishing or updating the protocol management library according to the data request protocol.
In this step, the detected data request end and the request processing end are unified and classified into the protocol management library for management.
S403: and screening out a corresponding channel to be selected and a protocol to be selected in the protocol management library according to the environment characteristic identification.
In this step, the environment feature identifier includes a front-end application identifier and a back-end application identifier. Each channel to be selected and the protocol to be selected corresponding to the front-end application identifier and the back-end application identifier are stored in the protocol management library, and the corresponding channel to be selected and the protocol to be selected can be found only according to the environment characteristic identifier of the current data request terminal.
S404: and determining a target channel and a target protocol according to the preset efficiency condition, the channel to be selected and the protocol to be selected.
S405: and acquiring rendering data of the target page through the target channel and the target protocol.
Steps S404 to S405 may refer to steps S202 to S203 in the data request method shown in fig. 2 or steps S303 to S305 in the data request method described in fig. 3, and are not described herein again.
According to the data request method provided by the embodiment of the disclosure, by using the form of the protocol management library, a program developer does not need to care about the problem of the used protocol when developing an application program or an operating system or a management system of a front-end system, and subsequently, if a new protocol version is released, only a new protocol needs to be added into the protocol management library.
Corresponding to the media push method in the foregoing embodiment, fig. 5 is a block diagram of a data request device provided in the embodiment of the present disclosure. For ease of illustration, only portions that are relevant to embodiments of the present disclosure are shown. Referring to fig. 5, the apparatus includes:
an obtaining module 501, configured to obtain a page rendering instruction;
a processing module 502, configured to determine an environment feature identifier of a data request end according to a page rendering instruction, where the page rendering instruction is used to trigger display of a target page, and the environment feature identifier is used to characterize an application environment type corresponding to the data request end;
the processing module 502 is further configured to determine a target channel and a target protocol according to the environment feature identifier and a preset efficiency condition;
the obtaining module 501 is further configured to obtain rendering data of the target page through the target channel and the target protocol.
In an embodiment of the present disclosure, the environment feature identifier includes a front-end application identifier, where the front-end application identifier is used to characterize the data request end as a front-end application program, the front-end application program is used to render a target page by using rendering data, and the processing module 502 is further configured to determine a target channel and a target protocol according to the environment feature identifier and a preset efficiency condition, including:
the processing module 502 is further configured to screen out a target channel and a target protocol that meet a preset efficiency condition from each channel to be selected and the protocol to be selected according to the front-end application identifier.
In an embodiment of the present disclosure, the environment feature identifier includes a back-end application identifier, where the back-end application identifier is used to represent that the data request end is a back-end service program, and the back-end service program is used to render a target page in the back-end system by using rendering data, and return the target page to the front-end application program for display;
correspondingly, the processing module 502 is further configured to determine a target channel and a target protocol according to the environment feature identifier and the preset efficiency condition, including:
the processing module 502 is further configured to screen out a target channel and a target protocol that meet a preset efficiency condition from each channel to be selected and the protocol to be selected according to the backend application identifier.
In an embodiment of the present disclosure, the candidate channel corresponding to the front-end application identifier includes: browser environment channel and application APP environment channel.
In an embodiment of the present disclosure, the browser native interface includes a first path and/or a second path, the first path includes an XMLHttpRequest method instruction, the second path includes a Fetch method instruction, the candidate protocol includes a hypertext transfer HTTP protocol, and the processing module 502 is further configured to screen, according to the front-end application identifier, a target channel and a target protocol that meet a preset efficiency condition from among the respective candidate channels and the candidate protocols, including:
the processing module 502 is further configured to determine, according to the front-end application identifier, that the target channel is a first path and/or a second path of the native interface of the browser, and that the target protocol is an HTTP protocol;
the obtaining module 501 is further configured to obtain rendering data of a target page through a target channel and a target protocol, and includes:
the obtaining module 501 is further configured to send an HTTP request through the first path and/or the second path and an HTTP protocol to obtain rendering data.
In an embodiment of the present disclosure, the APP environment channel includes an application connection bridge, the application connection bridge includes a JSBridge method instruction, the candidate protocol includes a hypertext transfer HTTP protocol, and the processing module 502 is further configured to screen out, from each candidate channel and candidate protocol, a target channel and a target protocol that meet a preset efficiency condition according to the front-end application identifier, including:
the processing module 502 is further configured to determine, according to the front-end application identifier, that the target channel is a first path and/or a second path of the native interface of the browser, and/or an application program connection bridge, and that the target protocol is an HTTP protocol;
the obtaining module 501 is further configured to obtain rendering data of a target page through a target channel and a target protocol, and includes:
the obtaining module 501 is further configured to send an HTTP request through the first path, and/or the second path, and/or the application connection bridge and the HTTP protocol, so as to obtain rendering data.
In an embodiment of the present disclosure, the candidate channels corresponding to the backend application identifier include a backend service channel, the candidate protocols include a hypertext transfer protocol HTTP protocol and a remote call RPC protocol, and the processing module 502 is further configured to screen out a target channel and a target protocol that meet a preset efficiency condition from each of the candidate channels and the candidate protocols according to the backend application identifier, including:
the processing module 502 is further configured to determine that the target channel is a backend service channel according to the backend application identifier;
the processing module 502 is further configured to determine that the target protocol is an RPC protocol if the back-end service program supports the RPC protocol, and otherwise determine that the target protocol is an HTTP protocol.
In an embodiment of the present disclosure, the obtaining module 501 is further configured to obtain rendering data of a target page through a target channel and a target protocol, including:
the obtaining module 501 is further configured to obtain rendering data by setting a target channel and a target protocol in a configuration component of the external data interface, where the configuration component is a configuration component in a relative URL uniform resource locator obtained by the external data interface.
In an embodiment of the present disclosure, the obtaining module 501, configured to determine an environment feature identifier of a data request end according to an obtained page rendering instruction, includes:
an obtaining module 501, configured to obtain an operation instruction of a user on an application interface; determining a page rendering instruction according to the operation instruction; and determining the environment characteristic identification according to the page rendering instruction.
In an embodiment of the present disclosure, the obtaining module 501, configured to determine an environment feature identifier of a data request end according to an obtained page rendering instruction, includes:
an obtaining module 501, configured to obtain an operation instruction of a user on a browser interface; determining a first data request according to the operation instruction and the native interface of the browser; analyzing the first data request through an external data interface to determine a page rendering instruction; and determining the environment characteristic identification according to the page rendering instruction.
In one embodiment of the present disclosure, the preset efficiency condition includes screening out a protocol with the highest transmission efficiency from all protocols supported by the data request side.
In an embodiment of the present disclosure, the processing module 502 is configured to determine a target channel and a target protocol according to the environment feature identifier and a preset efficiency condition, including:
a processing module 502, configured to screen out, in a protocol management library, a corresponding to-be-selected channel and a to-be-selected protocol according to an environment feature identifier, where the environment feature identifier includes a front-end application identifier and a back-end application identifier;
the processing module 502 is further configured to determine a target channel and a target protocol according to a preset efficiency condition, a candidate channel, and a candidate protocol.
In an embodiment of the present disclosure, before the obtaining module 501 is configured to determine the environment feature identifier of the data request end according to the obtained page rendering instruction, the method further includes:
the processing module 502 is further configured to determine, according to an application environment of the data request end, each data request protocol supported by the data request end and the request processing end;
the processing module 502 is further configured to establish or update a protocol management library according to the data request protocol.
The apparatus 500 provided in this embodiment may be configured to perform steps related to the user side in the technical solution of the foregoing method embodiment, and the implementation principle and the technical effect are similar, which are not described herein again.
Referring to fig. 6, a schematic structural diagram of an electronic device 600 suitable for implementing the embodiment of the present disclosure is shown, where the electronic device 600 may be a terminal device or a server. Among them, the terminal Device may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a Digital broadcast receiver, a Personal Digital Assistant (PDA), a tablet computer (PAD), a Portable Multimedia Player (PMP), a car terminal (e.g., car navigation terminal), etc., and a fixed terminal such as a Digital TV, a desktop computer, etc. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 6, the electronic device 600 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 601, which may perform various suitable actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of Network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer program product is also provided in the disclosed embodiments, comprising a computer program that, when executed by a processor, implements the methods in the embodiments described above.
In a first aspect, according to one or more embodiments of the present disclosure, there is provided a data request method, including:
determining an environment feature identifier of a data request end according to an obtained page rendering instruction, wherein the page rendering instruction is used for triggering display of a target page, and the environment feature identifier is used for representing an application environment type corresponding to the data request end;
determining a target channel and a target protocol according to the environment feature identification and a preset efficiency condition, wherein the target channel is an execution object for sending a request, and the target protocol is used for organizing a transfer mode of the request;
and acquiring rendering data of the target page through the target channel and the target protocol.
According to one or more embodiments of the present disclosure, the environment feature identifier includes a front-end application identifier, the front-end application identifier is used to characterize the data request end as a front-end application program, the front-end application program is used to render a target page by using rendering data, and a target channel and a target protocol are determined according to the environment feature identifier and a preset efficiency condition, including:
and screening target channels and target protocols which meet preset efficiency conditions from all channels to be selected and protocols to be selected according to the front-end application identification.
According to one or more embodiments of the present disclosure, the environment feature identifier includes a back-end application identifier, the back-end application identifier is used for representing the data request end as a back-end service program, and the back-end service program is used for rendering a target page in the back-end system by using rendering data, and returning the target page to the front-end application program for display;
correspondingly, determining a target channel and a target protocol according to the environment feature identifier and the preset efficiency condition comprises the following steps:
and screening target channels and target protocols which meet preset efficiency conditions from all channels to be selected and protocols to be selected according to the back-end application identification.
According to one or more embodiments of the present disclosure, the channel to be selected corresponding to the front-end application identifier includes: browser environment channel and application APP environment channel.
According to one or more embodiments of the present disclosure, a browser native interface includes a first path and/or a second path, the first path includes an XMLHttpRequest method instruction, the second path includes a Fetch method instruction, a candidate protocol includes a hypertext transfer HTTP protocol, and a target channel and a target protocol that meet a preset efficiency condition are screened from each candidate channel and candidate protocol according to a front-end application identifier, including:
determining a first path and/or a second path of a target channel as a native interface of the browser according to the front-end application identifier, wherein the target protocol is an HTTP (hyper text transport protocol);
acquiring rendering data of a target page through a target channel and a target protocol, wherein the rendering data comprises:
and sending an HTTP request through the first path and/or the second path and an HTTP protocol to acquire rendering data.
According to one or more embodiments of the present disclosure, an APP environment channel includes an application connection bridge, the application connection bridge includes JSBridge method instructions, a candidate protocol includes a hypertext transfer HTTP protocol, and a target channel and a target protocol that meet a preset efficiency condition are screened from each candidate channel and candidate protocol according to a front-end application identifier, including:
determining a first path and/or a second path of a target channel as a browser native interface and/or an application program connection bridge according to a front-end application identifier, wherein a target protocol is an HTTP (hyper text transport protocol);
acquiring rendering data of a target page through a target channel and a target protocol, wherein the rendering data comprises:
and sending an HTTP request through the first path and/or the second path and/or the application program connection bridge and the HTTP protocol to acquire rendering data.
According to one or more embodiments of the present disclosure, the candidate channels corresponding to the backend application identifier include a backend service channel, the candidate protocols include a hypertext transfer protocol (HTTP) protocol and a remote call (RPC) protocol, and a target channel and a target protocol that meet a preset efficiency condition are screened from each of the candidate channels and the candidate protocols according to the backend application identifier, including:
determining the target channel as a back-end service channel according to the back-end application identifier;
if the back-end service program supports the RPC protocol, the target protocol is the RPC protocol, otherwise, the target protocol is the HTTP protocol.
According to one or more embodiments of the present disclosure, acquiring rendering data of a target page through a target channel and a target protocol includes:
the rendering data is obtained by setting a target channel and a target protocol in a configuration component of the external data interface, wherein the configuration component is a configuration component in a relative URL uniform resource locator obtained by the external data interface.
According to one or more embodiments of the present disclosure, determining an environment feature identifier of a data request end according to an obtained page rendering instruction includes:
acquiring an operation instruction of a user on an application program interface;
determining a page rendering instruction according to the operation instruction;
and determining the environment characteristic identification according to the page rendering instruction.
According to one or more embodiments of the present disclosure, determining an environment feature identifier of a data request end according to an obtained page rendering instruction includes:
acquiring an operation instruction of a user on a browser interface;
determining a first data request according to the operation instruction and the native interface of the browser;
analyzing the first data request through an external data interface to determine a page rendering instruction;
and determining the environment characteristic identification according to the page rendering instruction.
According to one or more embodiments of the present disclosure, the preset efficiency condition includes screening out a protocol with the highest transmission efficiency from all protocols supported by the data requesting terminal.
According to one or more embodiments of the present disclosure, determining a target channel and a target protocol according to an environment feature identifier and a preset efficiency condition includes:
screening out a corresponding channel to be selected and a protocol to be selected according to an environment characteristic identifier in a protocol management library, wherein the environment characteristic identifier comprises a front-end application identifier and a back-end application identifier;
and determining a target channel and a target protocol according to the preset efficiency condition, the channel to be selected and the protocol to be selected.
According to one or more embodiments of the present disclosure, before determining the environment feature identifier of the data request end according to the obtained page rendering instruction, the method further includes:
determining each data request protocol supported by the data request end and the request processing end according to the application environment of the data request end;
and establishing or updating the protocol management library according to the data request protocol.
In a second aspect, according to one or more embodiments of the present disclosure, there is provided a data request apparatus including:
the acquisition module is used for acquiring a page rendering instruction;
the processing module is used for determining an environment feature identifier of the data request end according to a page rendering instruction, the page rendering instruction is used for triggering display of a target page, and the environment feature identifier is used for representing an application environment type corresponding to the data request end;
the processing module is further used for determining a target channel and a target protocol according to the environment feature identification and a preset efficiency condition, wherein the target channel is an execution object for sending a request, and the target protocol is used for organizing a transfer mode of the request;
and the acquisition module is also used for acquiring the rendering data of the target page through the target channel and the target protocol.
According to one or more embodiments of the present disclosure, the environment feature identifier includes a front-end application identifier, the front-end application identifier is used to characterize the data request end as a front-end application program, the front-end application program is used to render a target page by using rendering data, and the processing module is further used to determine a target channel and a target protocol according to the environment feature identifier and a preset efficiency condition, including:
and the processing module is also used for screening out a target channel and a target protocol which meet the preset efficiency condition from each channel to be selected and the protocol to be selected according to the front-end application identifier.
According to one or more embodiments of the present disclosure, the environment feature identifier includes a back-end application identifier, the back-end application identifier is used for representing the data request end as a back-end service program, and the back-end service program is used for rendering a target page in the back-end system by using rendering data, and returning the target page to the front-end application program for display;
correspondingly, the processing module is further configured to determine a target channel and a target protocol according to the environment feature identifier and the preset efficiency condition, and includes:
and the processing module is also used for screening out a target channel and a target protocol which meet the preset efficiency condition from each channel to be selected and the protocol to be selected according to the back-end application identifier.
According to one or more embodiments of the present disclosure, the channel to be selected corresponding to the front-end application identifier includes: browser environment channel and application APP environment channel.
According to one or more embodiments of the present disclosure, a browser native interface includes a first path and/or a second path, where the first path includes an XMLHttpRequest method instruction, the second path includes a Fetch method instruction, a candidate protocol includes a hypertext transfer HTTP protocol, and a processing module is further configured to screen, according to a front-end application identifier, a target channel and a target protocol that meet a preset efficiency condition from among various candidate channels and candidate protocols, including:
the processing module is also used for determining that the target channel is a first path and/or a second path of the native interface of the browser according to the front-end application identifier, and the target protocol is an HTTP (hyper text transport protocol);
the obtaining module is further configured to obtain rendering data of the target page through the target channel and the target protocol, and includes:
and the acquisition module is also used for sending an HTTP request through the first path and/or the second path and an HTTP protocol to acquire rendering data.
According to one or more embodiments of the present disclosure, an APP environment channel includes an application connection bridge, the application connection bridge includes JSBridge method instructions, a candidate protocol includes a hypertext transfer HTTP protocol, and a processing module, and is further configured to screen out, from each candidate channel and candidate protocol, a target channel and a target protocol that meet a preset efficiency condition according to a front-end application identifier, including:
the processing module is also used for determining that the target channel is a first path and/or a second path of a native interface of the browser and/or an application program connection bridge according to the front-end application identifier, and the target protocol is an HTTP protocol;
the obtaining module is further configured to obtain rendering data of the target page through the target channel and the target protocol, and includes:
and the acquisition module is also used for sending an HTTP request through the first path, the second path, the application program connection bridge and the HTTP protocol to acquire the rendering data.
According to one or more embodiments of the present disclosure, the candidate channels corresponding to the backend application identifier include a backend service channel, the candidate protocols include a hypertext transfer protocol HTTP protocol and a remote call RPC protocol, and the processing module is further configured to screen out a target channel and a target protocol that meet a preset efficiency condition from each of the candidate channels and the candidate protocols according to the backend application identifier, including:
the processing module is also used for determining the target channel as a back-end service channel according to the back-end application identifier;
and the processing module is also used for determining that the target protocol is the RPC protocol if the back-end service program supports the RPC protocol, or else, determining that the target protocol is the HTTP protocol.
According to one or more embodiments of the present disclosure, the obtaining module is further configured to obtain rendering data of a target page through a target channel and a target protocol, including:
the acquisition module is further configured to acquire rendering data by setting a target channel and a target protocol in a configuration component of the external data interface, where the configuration component is a configuration component in the relative URL uniform resource locator acquired by the external data interface.
According to one or more embodiments of the present disclosure, an obtaining module, configured to determine an environment feature identifier of a data request end according to an obtained page rendering instruction, includes:
the acquisition module is used for acquiring an operation instruction of a user on an application program interface; determining a page rendering instruction according to the operation instruction; and determining the environment characteristic identification according to the page rendering instruction.
According to one or more embodiments of the present disclosure, an obtaining module, configured to determine an environment feature identifier of a data request end according to an obtained page rendering instruction, includes:
the acquisition module is used for acquiring an operation instruction of a user on a browser interface; determining a first data request according to the operation instruction and the native interface of the browser; analyzing the first data request through an external data interface to determine a page rendering instruction; and determining the environment characteristic identification according to the page rendering instruction.
According to one or more embodiments of the present disclosure, the preset efficiency condition includes screening out a protocol with the highest transmission efficiency from all protocols supported by the data requesting terminal.
According to one or more embodiments of the present disclosure, a processing module, configured to determine a target channel and a target protocol according to an environment feature identifier and a preset efficiency condition, includes:
the processing module is used for screening out a corresponding channel to be selected and a protocol to be selected according to the environment characteristic identification in the protocol management library, wherein the environment characteristic identification comprises a front-end application identification and a back-end application identification;
and the processing module is also used for determining a target channel and a target protocol according to the preset efficiency condition, the channel to be selected and the protocol to be selected.
According to one or more embodiments of the present disclosure, before the obtaining module is configured to determine the environment feature identifier of the data request end according to the obtained page rendering instruction, the method further includes:
the processing module is also used for determining the data request end and each data request protocol supported by the request processing end according to the application environment of the data request end;
and the processing module is also used for establishing or updating a protocol management library according to the data request protocol.
In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device including:
at least one processor and memory;
the memory stores a computer program;
the at least one processor executes the memory-stored computer program to cause the at least one processor to perform the data request method as described above in the first aspect and in various possible designs of the first aspect.
In a fourth aspect, according to one or more embodiments of the present disclosure, there is provided a computer-readable storage medium having a computer program stored therein, which when executed by a processor, implements a data request method as described above in the first aspect and various possible designs of the first aspect.
In a fifth aspect, according to one or more embodiments of the present disclosure, there is provided a computer program comprising a computer program which, when executed by a processor, implements a data request method as described above in the various possible designs of the first aspect.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (17)

1. A method of requesting data, comprising:
determining an environment feature identifier of a data request end according to an obtained page rendering instruction, wherein the page rendering instruction is used for triggering display of a target page, and the environment feature identifier is used for representing an application environment type corresponding to the data request end;
determining a target channel and a target protocol according to the environment feature identification and a preset efficiency condition, wherein the target channel is an execution object for sending a request, and the target protocol is used for organizing a transfer mode of the request;
and acquiring rendering data of the target page through the target channel and the target protocol.
2. The data requesting method according to claim 1, wherein the environment feature identifier includes a front-end application identifier, the front-end application identifier is used to characterize the data requesting end as a front-end application, the front-end application is used to render the target page by using the rendering data, and determining a target channel and a target protocol according to the environment feature identifier and a preset efficiency condition includes:
and if the application environment type is determined to be the front-end application identifier according to the environment characteristic identifier, screening a target channel and a target protocol which meet a preset efficiency condition from each channel to be selected and the protocol to be selected according to the front-end application identifier.
3. The data request method according to claim 1 or 2, wherein the environment feature identifier comprises a back-end application identifier, the back-end application identifier is used for characterizing that the data request end is a back-end service program, and the back-end service program is used for rendering the target page by using the rendering data in the back-end system and returning the target page to a front-end application program for display;
the determining of the target channel and the target protocol according to the environment feature identification and the preset efficiency condition comprises the following steps:
and if the application environment type is determined to be the back-end application identifier according to the environment characteristic identifier, screening a target channel and a target protocol which meet a preset efficiency condition from each channel to be selected and the protocol to be selected according to the back-end application identifier.
4. The data request method of claim 3, wherein the identifying, by the front-end application, the corresponding channel to be selected comprises: browser environment channel and application APP environment channel.
5. The data request method according to claim 4, wherein the browser environment channel includes a first path and/or a second path, the first path includes an XMLHttpRequest method instruction, the second path includes a Fetch method instruction, the candidate protocols include HTTP (hyper text transfer protocol), and the screening of the target channel and the target protocol meeting a preset efficiency condition from the respective candidate channels and the candidate protocols according to the front-end application identifier includes:
determining that the target channel is the first path and/or the second path of the browser environment channel according to the front-end application identifier, and the target protocol is the HTTP protocol;
the obtaining rendering data of the target page through the target channel and the target protocol includes:
and sending an HTTP request through the first path and/or the second path and the HTTP protocol to acquire the rendering data.
6. The data request method of claim 5, wherein the APP environment channel comprises an application connection bridge, the application connection bridge comprises JSbridge method instructions, the candidate protocols comprise hypertext transfer HTTP protocols, and the selecting, according to the front-end application identifier, a target channel and a target protocol that meet a preset efficiency condition from among the candidate channels and the candidate protocols comprises:
determining that the target channel is the first path and/or the second path of a native interface of a browser and/or the application program connection bridge according to the front-end application identifier, and the target protocol is the HTTP protocol;
the obtaining rendering data of the target page through the target channel and the target protocol includes:
and sending an HTTP request through the first path, the second path and/or the application program connecting bridge and the HTTP protocol to acquire the rendering data.
7. The data request method of claim 4, wherein the candidate channels corresponding to the backend application identifier include a backend service channel, the candidate protocols include a hypertext transfer protocol (HTTP) protocol and a remote call (RPC) protocol, and the step of screening the target channels and the target protocols meeting preset efficiency conditions from the candidate channels and the candidate protocols according to the backend application identifier comprises the steps of:
determining the target channel as the back-end service channel according to the back-end application identifier;
if the back-end service program supports the RPC protocol, the target protocol is the RPC protocol, otherwise, the target protocol is the HTTP protocol.
8. The data request method of claim 7, wherein the obtaining rendering data of the target page through the target channel and the target protocol comprises:
and setting the target channel and the target protocol through a configuration component of an external data interface to acquire the rendering data, wherein the configuration component is a configuration component in a relative URL uniform resource locator acquired by the external data interface.
9. The data request method according to claim 1, wherein the determining the environment feature identifier of the data request terminal according to the obtained page rendering instruction includes:
acquiring an operation instruction of a user on an application program interface;
determining the page rendering instruction according to the operation instruction;
and determining the environment feature identification according to the page rendering instruction.
10. The data request method according to claim 1, wherein the determining the environment feature identifier of the data request terminal according to the obtained page rendering instruction includes:
acquiring an operation instruction of a user on a browser interface;
determining a first data request according to the operation instruction and a native interface of the browser;
parsing the first data request through an external data interface to determine the page rendering instruction;
and determining the environment feature identification according to the page rendering instruction.
11. The data request method according to claim 1, wherein the predetermined efficiency condition comprises screening out a protocol with the highest transmission efficiency from all protocols supported by the data request end.
12. The data request method of claim 1, wherein the determining a target channel and a target protocol according to the environment feature identifier and a preset efficiency condition comprises:
screening out a corresponding channel to be selected and a protocol to be selected according to the environment characteristic identification in a protocol management library, wherein the environment characteristic identification comprises a front-end application identification and a back-end application identification;
and determining the target channel and the target protocol according to the preset efficiency condition, the channel to be selected and the protocol to be selected.
13. The data request method according to claim 12, before determining the environment feature identifier of the data request end according to the obtained page rendering instruction, further comprising:
determining each data request protocol supported by the data request terminal and the request processing terminal according to the application environment of the data request terminal;
and establishing or updating the protocol management library according to the data request protocol.
14. A data request apparatus, comprising:
the acquisition module is used for acquiring a page rendering instruction;
the processing module is used for determining an environment feature identifier of a data request end according to the page rendering instruction, the page rendering instruction is used for triggering display of a target page, and the environment feature identifier is used for representing an application environment type corresponding to the data request end;
the processing module is further configured to determine a target channel and a target protocol according to the environment feature identifier and a preset efficiency condition, where the target channel is an execution object for sending a request, and the target protocol is used to organize a transfer manner of the request;
the obtaining module is further configured to obtain rendering data of the target page through the target channel and the target protocol.
15. An electronic device, comprising:
at least one processor and memory;
the memory is used for storing a computer program;
the at least one processor executing the computer program stored by the memory causes the at least one processor to perform the data request method of any of claims 1 to 13.
16. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out a data request method according to any one of claims 1 to 13.
17. A computer program product comprising a computer program, characterized in that the computer program realizes the data request method of any one of claims 1 to 13 when executed by a processor.
CN202011643321.5A 2020-12-30 2020-12-30 Data request method, device, equipment, medium and program product Pending CN112631592A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011643321.5A CN112631592A (en) 2020-12-30 2020-12-30 Data request method, device, equipment, medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011643321.5A CN112631592A (en) 2020-12-30 2020-12-30 Data request method, device, equipment, medium and program product

Publications (1)

Publication Number Publication Date
CN112631592A true CN112631592A (en) 2021-04-09

Family

ID=75291004

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011643321.5A Pending CN112631592A (en) 2020-12-30 2020-12-30 Data request method, device, equipment, medium and program product

Country Status (1)

Country Link
CN (1) CN112631592A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050193324A1 (en) * 2004-02-26 2005-09-01 International Business Machines Corporation Method and apparatus for displaying embedded content in documents
US20100057775A1 (en) * 2008-08-28 2010-03-04 Alibaba Group Holding Limited Method and system for providing object information on the internet
CN104426983A (en) * 2013-09-05 2015-03-18 携程计算机技术(上海)有限公司 Website building system and method
CN105656686A (en) * 2016-02-29 2016-06-08 中国人民解放军国防信息学院 Self-adaptive equipment management adaptation method
US20160344881A1 (en) * 2015-05-20 2016-11-24 Mitsuo Ando Information processing system, information processing method and computer program product
CN108984170A (en) * 2017-06-02 2018-12-11 阿里巴巴集团控股有限公司 The multilingual rendering method of the H5 page and device
WO2019076155A1 (en) * 2017-10-20 2019-04-25 杭州海康威视数字技术股份有限公司 Data transmission method, camera and electronic device
US20190173960A1 (en) * 2017-10-27 2019-06-06 EMC IP Holding Company LLC Method, device and computer program product for protocol selection
CN112035768A (en) * 2020-08-27 2020-12-04 深圳市欢太科技有限公司 Page rendering method and device for fast application, storage medium and electronic equipment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050193324A1 (en) * 2004-02-26 2005-09-01 International Business Machines Corporation Method and apparatus for displaying embedded content in documents
US20100057775A1 (en) * 2008-08-28 2010-03-04 Alibaba Group Holding Limited Method and system for providing object information on the internet
CN104426983A (en) * 2013-09-05 2015-03-18 携程计算机技术(上海)有限公司 Website building system and method
US20160344881A1 (en) * 2015-05-20 2016-11-24 Mitsuo Ando Information processing system, information processing method and computer program product
CN105656686A (en) * 2016-02-29 2016-06-08 中国人民解放军国防信息学院 Self-adaptive equipment management adaptation method
CN108984170A (en) * 2017-06-02 2018-12-11 阿里巴巴集团控股有限公司 The multilingual rendering method of the H5 page and device
WO2019076155A1 (en) * 2017-10-20 2019-04-25 杭州海康威视数字技术股份有限公司 Data transmission method, camera and electronic device
US20190173960A1 (en) * 2017-10-27 2019-06-06 EMC IP Holding Company LLC Method, device and computer program product for protocol selection
CN112035768A (en) * 2020-08-27 2020-12-04 深圳市欢太科技有限公司 Page rendering method and device for fast application, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN108494860B (en) WEB access system, WEB access method and device for client
CN111581563A (en) Page response method and device, storage medium and electronic equipment
CN110069308B (en) Page starting method and device, electronic equipment and storage medium
CN110619100B (en) Method and apparatus for acquiring data
CN111930534A (en) Data calling method and device and electronic equipment
CN111400625B (en) Page processing method and device, electronic equipment and computer readable storage medium
US11886798B2 (en) Method and apparatus for obtaining loading time length of image in webpage, and electronic device
US11758087B2 (en) Multimedia conference data processing method and apparatus, and electronic device
CN111694757A (en) Application program testing method and device, electronic equipment and computer readable storage medium
CN111432001A (en) Method, apparatus, electronic device, and computer-readable medium for jumping scenes
WO2020199659A1 (en) Method and apparatus for determining push priority information
CN111309304A (en) Method, device, medium and electronic equipment for generating IDL file
CN111813685B (en) Automatic test method and device
CN112558933A (en) Component rendering method and device, readable medium and electronic equipment
CN110619101B (en) Method and apparatus for processing information
CN111352872A (en) Execution engine, data processing method, apparatus, electronic device, and medium
CN111783010A (en) Webpage blank page monitoring method, device, terminal and storage medium
CN111382039A (en) Method, device, electronic equipment and storage medium for reporting user behavior event
CN113590985B (en) Page jump configuration method and device, electronic equipment and computer readable medium
CN111338928A (en) Chrome-based browser testing method and device
CN112631592A (en) Data request method, device, equipment, medium and program product
CN111367592B (en) Information processing method and device
JP2023527174A (en) Video special effect arrangement method, video special effect arrangement device, device and storage medium
CN112732457A (en) Image transmission method, image transmission device, electronic equipment and computer readable medium
CN113542335A (en) Information sharing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination