WO2022134425A1 - 小程序运行方法及装置、电子设备、介质 - Google Patents

小程序运行方法及装置、电子设备、介质 Download PDF

Info

Publication number
WO2022134425A1
WO2022134425A1 PCT/CN2021/092041 CN2021092041W WO2022134425A1 WO 2022134425 A1 WO2022134425 A1 WO 2022134425A1 CN 2021092041 W CN2021092041 W CN 2021092041W WO 2022134425 A1 WO2022134425 A1 WO 2022134425A1
Authority
WO
WIPO (PCT)
Prior art keywords
service request
applet
request
service
sending
Prior art date
Application number
PCT/CN2021/092041
Other languages
English (en)
French (fr)
Inventor
陈都
陈玉祯
Original Assignee
北京百度网讯科技有限公司
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 北京百度网讯科技有限公司 filed Critical 北京百度网讯科技有限公司
Publication of WO2022134425A1 publication Critical patent/WO2022134425A1/zh

Links

Images

Classifications

    • 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44568Immediately runnable code

Definitions

  • the present disclosure relates to the fields of Internet technologies such as applet technology, cloud computing, and cloud platforms, and for example, relates to a method and apparatus for running an applet, an electronic device, and a computer-readable medium.
  • More and more applications can carry the operation of the applet.
  • the applet As an application that can be used without downloading and installing, the applet enables users to use the services provided by the applet more conveniently and quickly.
  • Mini Programs With the wide application of Mini Programs, users have higher and higher requirements for experience when using Mini Programs. During the use of Mini Programs, when the Mini Program starts or responds slowly to page jumps, it will increase the number of users in the loading state. waiting time, resulting in poor user experience.
  • the present disclosure provides a method and apparatus for running an applet, an electronic device, and a computer-readable medium.
  • the present disclosure provides a method for running an applet, including: in response to a trigger event for an applet, sending a first service request and at least one second service request to an applet server; in response to receiving the first service request and a request response message of a service request in the at least one second service request, to obtain service data corresponding to the service request; based on the service data, render and load the applet corresponding to the service data Content.
  • the present disclosure also provides a device for running an applet, comprising: a request sending module configured to send a first service request and at least one second service request to an applet server in response to a trigger event for the applet; a data acquisition module, is configured to obtain service data corresponding to the one service request in response to receiving a request response message for a service request in the first service request and the at least one second service request; the data rendering module is set to Based on the business data, the content of the applet corresponding to the business data is rendered and loaded.
  • the present disclosure also provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor; wherein the memory stores at least one processor executable by the at least one processor instruction, the at least one instruction is executed by the at least one processor, so that the at least one processor can execute the above-mentioned applet running method.
  • the present disclosure also provides a computer-readable medium storing a computer program, wherein, when the computer program is executed, the above-mentioned method for running a small program is implemented.
  • the present disclosure also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned method for running a small program.
  • FIG. 1 is a flowchart of a method for running an applet provided by an embodiment of the present disclosure
  • FIG. 2 is a flowchart of another applet running method provided by an embodiment of the present disclosure
  • Fig. 3 is a flow chart of a specific implementation of step S1 in Fig. 1;
  • FIG. 4 is a block diagram of the composition of an apparatus for running an applet provided by an embodiment of the present disclosure
  • FIG. 5 is a block diagram of an electronic device according to an embodiment of the present disclosure.
  • FIG. 1 is a flowchart of a method for running an applet provided by an embodiment of the present disclosure.
  • an embodiment of the present disclosure provides a method for running an applet.
  • the method can be executed by an applet running device, and the device can be implemented in software and/or hardware.
  • the device can be integrated in an electronic device such as a mobile terminal. in the device.
  • the operation method of the applet includes:
  • Step S1 In response to a trigger event for the applet, send a first service request and at least one second service request to the applet server.
  • Step S2 in response to currently receiving a request response message for any one of the first service request and the at least one second service request, obtain service data corresponding to the one service request.
  • Step S3 based on the business data, render and load the content of the corresponding applet.
  • the applet running method obtains corresponding business data by sending multiple business requests to the applet server in response to a trigger event for the applet, and renders the corresponding business data to present the corresponding applet Content.
  • sending multiple service requests to compete for requests can not only reduce the probability of request return failure, but also effectively ensure that the request can be returned and responded effectively, and trigger events (such as starting the applet event or the applet).
  • the real response time of the program page jump event) is the business request with the shortest response time, which reduces the response time of business data to a certain extent, improves the response speed of business data, and effectively improves the user experience.
  • sending multiple service requests to compete for requests can effectively improve the first effective rendering (drawing) (First Meaningful Paint, FMP) time of the applet, and improve the efficiency of the applet. performance.
  • the trigger event for the applet may be, for example, a startup event or a page jump event of the applet.
  • the trigger event for the applet may be an event generated by the user triggering a corresponding control, or an event triggered by the user through voice, or a user scanning the two-dimensional code of the applet. Trigger generated events, etc. For example, when the user clicks the icon of the applet or scans the QR code of the applet, a startup event of the applet is generated.
  • the embodiments of the present disclosure do not limit the triggering manner of the triggering event for the applet.
  • the applet server is a developer server corresponding to the applet, and is set to provide various service support for the applet.
  • the applet is hosted on a host application
  • the host application is a client (application)
  • the host application can be installed on an electronic device
  • the host application can carry multiple applet programs.
  • the program can be any applet hosted by any host application on the electronic device.
  • the electronic device may be, for example, a mobile terminal, and the mobile terminal may be various hardware devices with operating systems, such as a mobile phone, a tablet computer, and a personal digital assistant.
  • the above-mentioned apparatus for running an applet may be integrated into a host application, that is, the above-mentioned method for running an applet may be implemented based on the host application of the applet.
  • the method may further include: starting the applet in response to the trigger event for the applet The steps of the corresponding applet framework.
  • the step of starting the applet framework corresponding to the applet may include: acquiring and loading the developer business code corresponding to the applet to start the applet framework.
  • the developer business code corresponding to the applet may be an app.js file.
  • the above-mentioned applet running device may also be integrated into the applet framework of the applet, that is, the above-mentioned applet running method may be implemented based on the applet framework, for example, the applet framework is a software development kit ( Software Development Kit, SDK).
  • the trigger event is a startup event
  • step S1 in response to the trigger event for the applet, when the applet framework corresponding to the applet is started, a first service request and at least one second service are sent to the applet server ask.
  • the host application starts the applet framework in response to the triggering event for the applet.
  • the applet running device in the applet framework sends the first service request and at least one second service request to the applet server.
  • sending the first service request and the at least one second service request to the applet server includes: calling a preset data request interface to send the first service request and at least one second service to the applet server ask.
  • the preset data request interface is a preset data request interface in the applet framework corresponding to the applet, and the preset data request interface (request Application Programming Interface (API)) may be, for example, a swan.request API.
  • FIG. 2 is a flowchart of another applet running method provided by an embodiment of the present disclosure.
  • step S1 a first service request and at least one applet server are sent to the applet server.
  • step S01 is further included, and after step S01, steps S02 to S04 are further included.
  • Step S01 in response to a trigger event for the applet, identify whether the interface parameters of the preset data request interface in the applet frame of the applet include the preset request parameters, if the interface parameters of the preset data request interface in the applet frame If the preset request parameter is included, step S1 is executed, and if the interface parameter of the preset data request interface in the applet framework does not include the preset request parameter, step S02 is executed.
  • the preset request parameter is a parameter representing multiple requests.
  • a developer may add an extension field to the interface parameters of the preset data request interface, and the extension field may include a parameter indicating whether to send multiple requests, a request delay control parameter, and a protocol field parameter.
  • the key of the extension field can be "ext"
  • the value can be an object object
  • the format of the object object can be ⁇ "resend”: “true”
  • “protocol”: "http or quic”
  • "resend”: "true” is the parameter representing multiple requests
  • "delay”: "300ms” is the corresponding request delay control parameter
  • "protocol”: "http or quic” is the corresponding protocol field parameter.
  • step S01 in response to a trigger event for the applet, if it is identified that the interface parameters of the preset data request interface in the applet framework include the above-mentioned extension fields, and the extension fields include parameters representing multiple requests, then it is identified that The interface parameters of the preset data request interface in the applet framework of the applet include preset request parameters, if it is identified that the interface parameters of the preset data request interface in the applet If the parameter representing multiple requests is included, it is identified that the interface parameter of the preset data request interface in the applet framework of the applet does not include the preset request parameter.
  • step S01 in response to identifying that the interface parameters of the preset data request interface in the applet framework of the applet include preset request parameters, perform step S1 to send a first service request and at least one second service to the applet server requested steps.
  • Step S02 Send a first service request to the applet server.
  • the preset data request interface in the applet framework of the applet is called, and the first service request is sent to the applet server.
  • Step S03 Acquire service data corresponding to the first service request in response to the request response message for the first service request.
  • the applet server After sending the first service request to the applet server, check whether the request response message returned by the applet server for the first service request has been received. If the request response message returned by the applet server for the first service request has been received, Then, in response to the request response message for the first service request, the service data corresponding to the first service request is acquired. If the request response message returned by the applet server for the first service request is still not received within the preset timeout period, an exception handling is performed. The information is the failure to start the applet, the failure to load the page, etc.
  • Step S04 based on the business data, render and load the content of the corresponding applet.
  • step S01 in response to identifying that the interface parameters of the preset data request interface in the applet framework of the applet do not contain preset request parameters, in response to the trigger event for the applet, only send For a service request, step S02 to step S04 are executed to perform operations corresponding to the trigger event.
  • FIG. 3 is a flowchart of a specific implementation of step S1 in FIG. 2.
  • the first service request and at least one second service request are sent by asynchronously sending requests.
  • step S1 may include steps S11 to S13.
  • Step S11 Send a first service request to the applet server, and start a preset timer.
  • a preset data request interface is invoked to send a first service request to the applet server, and a preset timer is started.
  • the first service request may be sent based on a HyperText Transfer Protocol (HyperText Transfer Protocol, HTTP) or a low-latency Internet Transport Layer Protocol (Quick UDP Internet Connection, QUIC) based on a User Datagram Protocol (User Datagram Protocol, UDP). .
  • HTTP HyperText Transfer Protocol
  • QUIC Low-latency Internet Transport Layer Protocol
  • UDP User Datagram Protocol
  • the interface parameters of the preset data request interface also include a request delay control parameter corresponding to the preset request parameter, and the preset timer is a timer corresponding to the request delay control parameter.
  • start and request delay The preset timer corresponding to the control parameter. For example, if the value of the request delay control parameter is 300ms, a timer of 300ms is started.
  • Step S12 when the preset timer expires, check whether the request response message returned by the applet server for the first service request has been received, and if the request response message returned by the applet server for the first service request has been received, then Step S03 is performed, and step S13 is performed if the request response message returned by the applet server for the first service request has not been received.
  • the timer is 300ms
  • the timer reaches the 300th ms, it is checked whether the request response message returned by the applet server for the first service request has been received.
  • Step S13 Send at least one second service request to the applet server when it is checked that the request response message for the first service request is not currently received.
  • step S13 when it is checked that the request response message for the first service request is not currently received, a preset data request interface is invoked to send at least one second service request to the applet server.
  • the interface parameters of the preset data request interface further include protocol field parameters corresponding to the preset request parameters.
  • at least one second service request is sent to the applet server based on the transmission protocol corresponding to the protocol field parameters.
  • the protocol field parameter may include the HTTP protocol field parameter or the QUIC protocol field parameter, the transmission protocol corresponding to the HTTP protocol field parameter is HTTP, and the transmission protocol corresponding to the QUIC protocol field parameter is QUIC.
  • the multiple second service requests may also be sent separately by asynchronously sending requests, for example, sending the second service requests at a certain interval.
  • the method before step S2, further includes: checking whether a request response message for any one of the first service request and the at least one second service request has been received currently. If a request response message for any one of the first service request and the at least one second service request is currently received, step S2 is performed to obtain service data corresponding to the first service request or the second service request. If the request response message returned by the applet server for any one of the first service request and at least one second service request has not been received within the preset timeout period, the exception handling is performed, for example, the exception handling is as follows: Returns the prompt information that triggers the event processing exception to the user, for example, the prompt information is the applet startup failure, page loading failure and other information.
  • the first service request and the at least one second service request are the same service request, and both are used to request to obtain the same service data.
  • the request response message returned by the applet server may include the business data corresponding to the business request, or after receiving the request response message, the business data corresponding to the business request may be obtained by interacting with the applet server.
  • the trigger event for the applet is a startup event
  • the first service request and the at least one second service request may be a rendering request for the first screen page of the applet or a rendering request for a preset advertisement page
  • the business data corresponding to the business request is the first screen page of the applet or the page data of the preset advertisement page.
  • step S3 based on the service data, the content of the corresponding applet is rendered and loaded, so as to draw and present the corresponding page and start the applet.
  • the trigger event for the applet is a page jump event
  • the first service request and the at least one second service request may be a rendering request for the page to be jumped, and correspondingly, the service data corresponding to the service request It is the page data of the page to be redirected.
  • the content of the corresponding applet is rendered and loaded to draw and present the corresponding page, thereby completing the page jump.
  • the page jump refers to jumping from the currently displayed page of the applet to another page for display, and the page jump event may be an event generated by the user clicking a page component or link, address, etc. on the current display page of the applet.
  • the method may further include: canceling the sending process of at least one second service request in response to a request response message for the first service request being currently received.
  • it may further include: in response to having received a request response message for any second service request currently, canceling the sending process of the first service request, and when the number of the second service requests is In the case of more than one, cancel the sending process of other second service requests. In this way, the request congestion of the applet server is avoided, the load of the applet server is reduced, and the response delay that affects subsequent requests is avoided.
  • sending multiple service requests to compete for requests can not only reduce the probability of request return failure, effectively ensure that requests can be effectively returned and responded, and trigger events ( For example, the real response time of the Mini Program event or Mini Program page jump event) is the business request with the shortest response time, which reduces the response time of business data to a certain extent, improves the response speed of business data, and effectively improves the user experience. experience.
  • trigger events For example, the real response time of the Mini Program event or Mini Program page jump event
  • the real response time of the Mini Program event or Mini Program page jump event is the business request with the shortest response time, which reduces the response time of business data to a certain extent, improves the response speed of business data, and effectively improves the user experience. experience.
  • multiple service requests are sent to compete for requests, which can effectively improve the FMP time of the applet and improve the performance of the applet.
  • FIG. 4 is a block diagram of an apparatus for running an applet provided by an embodiment of the present disclosure.
  • an embodiment of the present disclosure provides an apparatus for running an applet 300 .
  • the apparatus for running an applet 300 includes a request sending module 301 , a data obtaining module 302 and a data rendering module 303 .
  • the request sending module 301 is configured to send a first service request and at least one second service request to the applet server in response to a trigger event for the applet.
  • the data acquisition module 302 is configured to acquire the service data corresponding to the service request in response to the request response message currently received for any service request in the first service request and the at least one second service request; the data rendering module 303 Set to render and load the content of the corresponding applet based on business data.
  • the applet running apparatus 300 further includes an identification module (not shown in the figure), and the identification module is configured to identify whether the interface parameters of the preset data request interface in the applet framework of the applet include preset request parameters
  • the request sending module 301 is configured to send the first service request and at least one second service request to the applet server in response to the identification module identifying that the interface parameters of the preset data request interface in the applet framework include preset request parameters.
  • the applet running apparatus 300 further includes a task cancellation module (not shown in the figure), and the task cancellation module is configured to cancel the The sending process of at least one second service request; or, in response to currently receiving a request response message for any of the second service requests, cancel the sending process of the first service request; in the second service request In the case that the number of is more than one, in response to having received a request response message for any of the second service requests, the sending process of other second service requests is also canceled.
  • the applet running apparatus 300 provided by the embodiment of the present disclosure is configured to implement the applet running method provided by any of the above embodiments, and the relevant description can refer to the description of any of the above embodiments, and details are not repeated here.
  • the present disclosure also provides an electronic device, a computer-readable medium, and a computer program product.
  • FIG. 5 is a block diagram of an electronic device according to an embodiment of the present disclosure.
  • FIG. 5 shows a schematic block diagram of an electronic device 500 that may be used to implement embodiments of the present disclosure.
  • the electronic device 500 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers.
  • Electronic device 500 may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices.
  • the components shown herein, their connections and relationships, and their functions are by way of example only, and are not intended to limit implementations of the disclosure described and/or claimed herein.
  • the electronic device 500 includes a computing unit 501, which can be loaded into a random access memory (Random Access Memory, RAM) according to a computer program stored in a read-only memory (Read-Only Memory, ROM) 502 or from a storage unit 508 ) 503 to perform various appropriate actions and processes.
  • RAM Random Access Memory
  • ROM Read-Only Memory
  • various programs and data required for the operation of the electronic device 500 can also be stored.
  • the computing unit 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504.
  • An Input/Output (I/O) interface 505 is also connected to the bus 504 .
  • Various components in the electronic device 500 are connected to the I/O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, CD, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, and the like.
  • the communication unit 509 allows the device 500 to exchange information/data with other devices through a computer network such as the Internet and/or various telecommunication networks.
  • Computing unit 501 may be a variety of general-purpose and/or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), various dedicated artificial intelligence (Artificial Intelligence, AI) computing chips, various operating A computational unit, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc., for the algorithm of the machine learning model.
  • the computing unit 501 executes the methods and processes described above, such as the applet running method.
  • the applet execution method described above may be implemented as a computer software program or instructions tangibly embodied on a machine (computer) readable medium, such as storage unit 508 .
  • some or all of the computer program or instructions may be loaded and/or installed on device 500 via ROM 502 and/or communications unit 509 .
  • the computing unit 501 may be configured in any other suitable manner (eg, by means of firmware) to perform the applet running method described above.
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSP Application Specific Standard Parts
  • SoC System on Chip
  • CPLD Complex Programming Logic Device
  • programmable processor may be a special purpose or general-purpose programmable processor, and transmit data and instructions to the storage system, the at least one input device , and the at least one output device.
  • Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer or other programmable data processing apparatus, such that the program code, when executed by the processor or controller, performs the functions/functions specified in the flowcharts and/or block diagrams. Action is implemented.
  • the program code may execute entirely on the machine, partly on the machine, partly on the machine and partly on a remote machine as a stand-alone software package or entirely on the remote machine or server.
  • a machine (computer) readable medium may be a tangible medium that may contain or store a computer program for use by or in connection with the instruction execution system, apparatus or device .
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media examples include one or more wire-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (Erasable Programmable Read-Only Memory, EPROM or flash memory), fiber optics, Compact Disc Read-Only Memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing .
  • RAM random access memory
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • CD-ROM Compact Disc Read-Only Memory
  • optical storage devices magnetic storage devices, or any suitable combination of the foregoing .
  • the systems and techniques described herein can be implemented on a computer having a display device (eg, a cathode ray tube (CRT) or a liquid crystal display ( Liquid Crystal Display (LCD) monitor); and a keyboard and pointing device (eg, mouse or trackball) through which a user can provide input to the computer.
  • a display device eg, a cathode ray tube (CRT) or a liquid crystal display ( Liquid Crystal Display (LCD) monitor
  • a keyboard and pointing device eg, mouse or trackball
  • Other kinds of devices may also be configured to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (eg, visual feedback, auditory feedback, or tactile feedback); and may be in any form (including acoustic input, voice input, or tactile input) to receive input from the user.
  • the systems and techniques described herein may be implemented on a computing system that includes back-end components (eg, as a data server), or a computing system that includes middleware components (eg, an application server), or a computing system that includes front-end components (eg, a user's computer having a graphical user interface or web browser through which a user may interact with implementations of the systems and techniques described herein), or including such backend components, middleware components, Or any combination of front-end components in a computing system.
  • the components of the system may be interconnected by any form or medium of digital data communication (eg, a communication network). Examples of communication networks include: Local Area Network (LAN), Wide Area Network (WAN), and the Internet.
  • a computer system can include clients and servers.
  • Clients and servers are generally remote from each other and usually interact through a communication network.
  • the relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other.
  • the present disclosure also provides a computer program product, including a computer program, which, when executed by a processor, implements any one of the above-mentioned methods for running an applet.
  • corresponding service data is obtained by sending multiple service requests to the applet server, and the corresponding service data is rendered to present the content of the corresponding applet.
  • sending multiple service requests to compete for requests can not only reduce the probability of request return failure, but also effectively ensure that the request can be returned and responded effectively, and trigger events (such as starting the applet event or the applet).
  • the real response time of the program page jump event is the business request with the shortest response time, which reduces the response time of business data to a certain extent, improves the response speed of business data, and effectively improves the user experience.
  • multiple service requests are sent to compete for requests, which can effectively improve the FMP time of the applet and improve the performance of the applet.
  • Steps can be reordered, added, or removed using the various forms of flow shown above.
  • the multiple steps described in the present disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, no limitation is imposed herein.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

一种小程序运行方法、装置、电子设备及计算机可读介质,方法包括:响应于针对小程序的触发事件,向小程序服务器发送第一业务请求和至少一个第二业务请求(S1);响应于当前已接收到针对所述第一业务请求和所述至少一个第二业务请求中的任一业务请求的请求响应消息,获取与该一业务请求对应的业务数据(S2);基于业务数据,渲染并加载相应的小程序的内容(S3)。

Description

小程序运行方法及装置、电子设备、介质
本申请要求在2020年12月23日提交中国专利局、申请号为202011539853.4的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本公开涉及小程序技术、云计算、云平台等互联网技术领域,例如涉及一种小程序运行方法及装置、电子设备、计算机可读介质。
背景技术
越来越多的应用程序能够承载小程序的运行,小程序作为一种不需要下载安装即可使用的应用,使得用户更加方便快捷地使用小程序提供的服务。
随着小程序的广泛应用,用户对使用小程序时的体验要求也越来越高,在使用小程序的过程中,小程序的启动或页面跳转响应较慢时,将增加用户在加载态的等待时间,从而导致用户体验不佳。
因此,如何有效改善小程序启动过程或页面跳转的响应速度和错误率,以提高用户体验成为亟待解决的技术问题。
发明内容
本公开提供一种小程序运行方法及装置、电子设备、计算机可读介质。
本公开提供了一种小程序运行方法,包括:响应于针对小程序的触发事件,向小程序服务器发送第一业务请求和至少一个第二业务请求;响应于接收到针对所述第一业务请求和所述至少一个第二业务请求中的一业务请求的请求响应消息,获取与所述一业务请求对应的业务数据;基于所述业务数据,渲染并加载所述业务数据对应的所述小程序的内容。
本公开还提供了一种小程序运行装置,包括:请求发送模块,设置为响应于针对小程序的触发事件,向小程序服务器发送第一业务请求和至少一个第二业务请求;数据获取模块,设置为响应于接收到针对所述第一业务请求和所述至少一个第二业务请求中的一业务请求的请求响应消息,获取与所述一业务请求对应的业务数据;数据渲染模块,设置为基于所述业务数据,渲染并加载所述业务数据对应的所述小程序的内容。
本公开还提供了一种电子设备,包括:至少一个处理器,以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个 处理器执行的至少一个指令,所述至少一个指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行上述的小程序运行方法。
本公开还提供了一种计算机可读介质,存储有计算机程序,其中,所述计算机程序被执行时实现如上述的小程序运行方法。
本公开还提供了一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现上述的小程序运行方法。
附图说明
图1为本公开实施例提供的一种小程序运行方法的流程图;
图2为本公开实施例提供的另一种小程序运行方法的流程图;
图3为图1中步骤S1的一种具体实现方式的流程图;
图4为本公开实施例提供的一种小程序运行装置的组成框图;
图5为本公开实施例提供的一种电子设备的组成框图。
具体实施方式
以下结合附图对本公开的示范性实施例做出说明,其中包括本公开实施例的多种细节以助于理解,应当将它们认为仅仅是示范性的。以下的描述中省略了对公知功能和结构的描述。
本文所使用的术语“和/或”包括一个或多个相关列举条目的任何和所有组合。
本文所使用的术语仅用于描述特定实施例,且不意欲限制本公开。如本文所使用的,单数形式“一个”和“该”也意欲包括复数形式,除非上下文另外指出。当本文中使用术语“包括”和/或“由……制成”时,指定存在所述特征、整体、步骤、操作、元件和/或组件,但不排除存在或添加一个或多个其它特征、整体、步骤、操作、元件、组件和/或其群组。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。
除非另外限定,否则本文所用的所有术语(包括技术和科学术语)的含义与本领域普通技术人员通常理解的含义相同。诸如那些在常用字典中限定的那些术语应当被解释为具有与其在相关技术以及本公开的背景下的含义一致的含义,且将不解释为具有理想化或过度形式上的含义,除非本文如此限定。
图1为本公开实施例提供的一种小程序运行方法的流程图。
参照图1,本公开实施例提供一种小程序运行方法,该方法可以由小程序运行装置来执行,该装置可以通过软件和/或硬件的方式实现,该装置可以集成在如移动终端等电子设备中。该小程序运行方法包括:
步骤S1、响应于针对小程序的触发事件,向小程序服务器发送第一业务请求和至少一个第二业务请求。
步骤S2、响应于当前已接收到针对第一业务请求和至少一个第二业务请求中的任一业务请求的请求响应消息,获取与该一业务请求对应的业务数据。
步骤S3、基于业务数据,渲染并加载相应的小程序的内容。
本公开实施例所提供的小程序运行方法,响应于针对小程序的触发事件,通过向小程序服务器发送多个业务请求的方式来获取相应业务数据,并渲染相应业务数据以呈现相应的小程序的内容。响应于针对小程序的触发事件,通过发送多个业务请求进行请求竞争,不仅能够降低请求返回失败的概率,有效确保了请求能够有效得到返回、响应,而且触发事件(如启动小程序事件或小程序页面跳转事件)的真实响应时间为响应时间最短的业务请求,在一定程度上降低了业务数据的响应时间,提升了业务数据的响应速度,从而有效提升了用户的体验度。在实际应用中,响应于针对小程序的启动事件,通过发送多个业务请求进行请求竞争,能够有效改善小程序的首次有效渲染(绘制)(First Meaningful Paint,FMP)时间,提升了小程序的性能。
在本公开实施例中,在步骤S1中,针对小程序的触发事件例如可以是小程序的启动事件或页面跳转事件等。
在本公开实施例中,针对小程序的触发事件可以是用户通过触发对应控件而生成的事件,也可以是用户通过语音方式触发生成的事件,还可以是用户通过扫描小程序二维码的方式触发生成的事件等。例如,用户点击小程序图标或者扫描小程序二维码时生成小程序的启动事件。本公开实施例对于针对小程序的触发事件的触发方式不作限制。
在本公开实施例中,在步骤S1中,小程序服务器为小程序对应的开发者服务器,设置为为小程序提供多种服务支持。
在本公开实施例中,小程序寄宿于宿主应用,宿主应用为客户端(应用程序),宿主应用可以安装于电子设备上,宿主应用上可以承载多个小程序,本公开实施例中的小程序可以是电子设备上的任一宿主应用承载的任一小程序。其中,电子设备例如可以是移动终端,该移动终端可以是手机、平板电脑、个人数字助理等多种具有操作系统的硬件设备。
在一些实施例中,上述小程序运行装置可以集成于宿主应用中,即上述小 程序运行方法可以基于小程序的宿主应用实现。在触发事件为启动事件的情形下,在步骤S1中,在向小程序服务器发送第一业务请求和至少一个第二业务请求之前,还可以包括:响应于针对小程序的触发事件,启动小程序对应的小程序框架的步骤。启动小程序对应的小程序框架的步骤可以包括:获取并加载小程序对应的开发者业务代码,以启动小程序框架。其中,小程序对应的开发者业务代码可以为app.js文件。
在一些实施例中,上述小程序运行装置还可以集成于小程序的小程序框架,即上述小程序运行方法可以基于小程序框架实现,例如小程序框架为小程序运行时的软件开发工具包(Software Development Kit,SDK)。在触发事件为启动事件的情形下,在步骤S1中,响应于针对小程序的触发事件,在小程序对应的小程序框架启动时,向小程序服务器发送第一业务请求和至少一个第二业务请求。宿主应用响应于针对小程序的触发事件,启动小程序框架,在小程序框架启动时,小程序框架中的小程序运行装置向小程序服务器发送第一业务请求和至少一个第二业务请求。
在一些实施例中,在步骤S1中,向小程序服务器发送第一业务请求和至少一个第二业务请求包括:调用预设数据请求接口向小程序服务器发送第一业务请求和至少一个第二业务请求。其中,预设数据请求接口为小程序对应的小程序框架中的预设数据请求接口,预设数据请求接口(request应用程序接口(Application Programming Interface,API))例如可以是swan.request API。
图2为本公开实施例提供的另一种小程序运行方法的流程图,如图2所示,在一些实施例中,在步骤S1中,在向小程序服务器发送第一业务请求和至少一个第二业务请求之前还包括步骤S01,在步骤S01之后还包括步骤S02~步骤S04。
步骤S01、响应于针对小程序的触发事件,识别小程序的小程序框架中的预设数据请求接口的接口参数是否包含预设请求参数,若小程序框架中的预设数据请求接口的接口参数包含预设请求参数则执行步骤S1,若小程序框架中的预设数据请求接口的接口参数不包含预设请求参数则执行步骤S02。
预设请求参数为表示多发请求的参数。
作为示例,开发者在开发小程序时,可以在预设数据请求接口的接口参数中增加扩展字段,扩展字段可以包含表示是否多发请求的参数、请求延时控制参数和协议字段参数。作为示例,扩展字段的key可以为“ext”,value为object对象,object对象的格式可以为{"resend":"true","delay":"300ms","protocol":"http or quic"},其中,"resend":"true"为表示多发请求的参数,"delay":"300ms"为对应的请求延时控制参数,"protocol":"http or quic"为对应的协议字段参数。
在步骤S01中,响应于针对小程序的触发事件,若识别出小程序框架中的预设数据请求接口的接口参数中包含上述扩展字段,且扩展字段中包含表示多发请求的参数,则识别出小程序的小程序框架中的预设数据请求接口的接口参数包含预设请求参数,若识别出小程序框架中的预设数据请求接口的接口参数中不包含上述扩展字段,或扩展字段中不包含表示多发请求的参数,则识别出小程序的小程序框架中的预设数据请求接口的接口参数不包含预设请求参数。
在步骤S01中,响应于识别出小程序的小程序框架中的预设数据请求接口的接口参数包含预设请求参数,执行步骤S1中向小程序服务器发送第一业务请求和至少一个第二业务请求的步骤。
步骤S02、向小程序服务器发送第一业务请求。
响应于识别出小程序的小程序框架中的预设数据请求接口的接口参数不包含预设请求参数,调用小程序框架中的预设数据请求接口,向小程序服务器发送第一业务请求。
步骤S03、响应于针对第一业务请求的请求响应消息,获取与第一业务请求对应的业务数据。
在向小程序服务器发送第一业务请求之后,检查当前是否已接收到小程序服务器针对第一业务请求返回的请求响应消息,若已接收到小程序服务器针对第一业务请求返回的请求响应消息,则响应于针对第一业务请求的请求响应消息,获取与第一业务请求对应的业务数据。若在预设超时时间内,仍未收到小程序服务器针对第一业务请求返回的请求响应消息,则进行异常情况处理,例如异常情况处理为向用户返回触发事件处理异常的提示信息,例如提示信息为小程序启动失败、页面加载失败等信息。
步骤S04、基于业务数据,渲染并加载相应的小程序的内容。
在一些实施例中,在步骤S01中,响应于识别出小程序的小程序框架中的预设数据请求接口的接口参数不包含预设请求参数,则响应于针对小程序的触发事件,仅发送一个业务请求,执行步骤S02至步骤S04,以进行与触发事件相应的操作。
图3为图2中步骤S1的一种具体实现方式的流程图,在一些实施例中,为了保证小程序服务器的性能,通过异步发送请求的方式发送第一业务请求和至少一个第二业务请求。如图3所示,步骤S1可以包括:步骤S11~步骤S13。
步骤S11、向小程序服务器发送第一业务请求,并启动预设定时器。
在步骤S11中,调用预设数据请求接口向小程序服务器发送第一业务请求,并启动预设定时器。其中,第一业务请求可以基于超文本传输协议(HyperText  Transfer Protocol,HTTP)或者基于用户数据报协议(User Datagram Protocol,UDP)的低时延的互联网传输层协议(Quick UDP Internet Connection,QUIC)发送。
预设数据请求接口的接口参数还包含与预设请求参数对应的请求延时控制参数,则预设定时器为与请求延时控制参数对应的定时器,在步骤S11中,启动与请求延时控制参数对应的预设定时器。例如,请求延时控制参数的值为300ms,则启动一个300ms的定时器。
步骤S12、在预设定时器到期时,检查当前是否已接收到小程序服务器针对第一业务请求返回的请求响应消息,若已接收到小程序服务器针对第一业务请求返回的请求响应消息则执行步骤S03,若未已接收到小程序服务器针对第一业务请求返回的请求响应消息则执行步骤S13。
例如,定时器为300ms的定时器,则在定时器计时到第300ms时,检查当前是否已接收到小程序服务器针对第一业务请求返回的请求响应消息。
步骤S13、在检查出当前未接收到针对第一业务请求的请求响应消息的情形下,向小程序服务器发送至少一个第二业务请求。
在步骤S13中,在检查出当前未接收到针对第一业务请求的请求响应消息的情形下,调用预设数据请求接口向小程序服务器发送至少一个第二业务请求。
预设数据请求接口的接口参数还包含与预设请求参数对应的协议字段参数,在步骤S13中,基于与协议字段参数对应的传输协议向小程序服务器发送至少一个第二业务请求。其中,协议字段参数可以包括HTTP的协议字段参数或者QUIC的协议字段参数,HTTP的协议字段参数对应的传输协议为HTTP,QUIC的协议字段参数对应的传输协议为QUIC。
在第二业务请求的数量为多个的情形下,同样可以通过异步发送请求的方式分别发送多个第二业务请求,例如间隔一定时间进行第二业务请求的发送。
在一些实施例中,在步骤S2之前,还包括:检查当前是否已接收到针对第一业务请求和至少一个第二业务请求中的任一业务请求的请求响应消息。若当前已接收到针对第一业务请求和至少一个第二业务请求中的任一业务请求的请求响应消息,则执行步骤S2,以获取与第一业务请求或者第二业务请求对应的业务数据。若在预设超时时间内,仍未收到小程序服务器针对第一业务请求和至少一个第二业务请求中的任一业务请求返回的请求响应消息,则进行异常情况处理,例如异常情况处理为向用户返回触发事件处理异常的提示信息,例如提示信息为小程序启动失败、页面加载失败等信息。
在本公开实施例中,第一业务请求和至少一个第二业务请求为相同的业务 请求,均用于请求获取相同的业务数据。其中,小程序服务器返回的请求响应消息中可以包含该业务请求对应的业务数据,或者在接收到请求响应消息后,通过与小程序服务器交互以获取与该业务请求对应的业务数据。
在一些实施例中,针对小程序的触发事件为启动事件,则第一业务请求和至少一个第二业务请求可以是针对小程序的首屏页面的渲染请求或者是预设广告页面的渲染请求,相应的,业务请求对应的业务数据为小程序的首屏页面或者是预设广告页面的页面数据。在步骤S3中,基于该业务数据,渲染并加载相应的小程序的内容,以绘制并呈现出相应的页面并启动小程序。
在一些实施例中,针对小程序的触发事件为页面跳转事件,则第一业务请求和至少一个第二业务请求可以是针对待跳转页面的渲染请求,相应的,业务请求对应的业务数据为待跳转页面的页面数据。在步骤S3中,基于该业务数据,渲染并加载相应的小程序的内容,以绘制并呈现出相应的页面,从而完成页面跳转。其中,页面跳转是指从小程序的当前显示页面跳转至另一页面进行显示,页面跳转事件可以是用户在小程序的当前显示页面点击一页面组件或链接、地址等而生成的事件。
在一些实施例中,在步骤S1之后还可以包括:响应于当前已接收到针对第一业务请求的请求响应消息,取消至少一个第二业务请求的发送进程。在一些实施例中,在步骤S1之后还可以包括:响应于当前已接收到针对任一第二业务请求的请求响应消息,取消第一业务请求的发送进程,并在第二业务请求的数量为多个的情形下,取消其他第二业务请求的发送进程。从而避免造成小程序服务器的请求拥堵,减轻小程序服务器的负载,同时避免影响后续请求的响应延时。
在本公开实施例中,响应于针对小程序的触发事件,通过发送多个业务请求进行请求竞争,不仅能够降低请求返回失败的概率,有效确保了请求能够有效得到返回、响应,而且触发事件(如启动小程序事件或小程序页面跳转事件)的真实响应时间为响应时间最短的业务请求,在一定程度上降低了业务数据的响应时间,提升了业务数据的响应速度,从而有效提升了用户的体验度。在实际应用中,响应于针对小程序的启动事件,通过发送多个业务请求进行请求竞争,能够有效改善小程序的FMP时间,提升了小程序的性能。
图4为本公开实施例提供的一种小程序运行装置的组成框图。
参照图4,本公开实施例提供了一种小程序运行装置300,该小程序运行装置300包括:请求发送模块301、数据获取模块302和数据渲染模块303。其中,请求发送模块301设置为响应于针对小程序的触发事件,向小程序服务器发送第一业务请求和至少一个第二业务请求。数据获取模块302设置为响应于当前 已接收到针对第一业务请求和至少一个第二业务请求中的任一业务请求的请求响应消息,获取与该一业务请求对应的业务数据;数据渲染模块303设置为基于业务数据,渲染并加载相应的小程序的内容。
在一些实施例中,小程序运行装置300还包括识别模块(图中未示出),识别模块设置为识别小程序的小程序框架中的预设数据请求接口的接口参数是否包含预设请求参数;请求发送模块301设置为响应于识别模块识别出小程序框架中的预设数据请求接口的接口参数包含预设请求参数,向小程序服务器发送第一业务请求和至少一个第二业务请求。
在一些实施例中,小程序运行装置300还包括任务取消模块(图中未示出),任务取消模块设置为响应于当前已接收到针对所述第一业务请求的请求响应消息,取消所述至少一个第二业务请求的发送进程;或者,响应于当前已接收到针对任一所述第二业务请求的请求响应消息,取消所述第一业务请求的发送进程;在所述第二业务请求的数量为多个的情形下,响应于当前已接收到针对任一所述第二业务请求的请求响应消息,还取消其他第二业务请求的发送进程。
本公开实施例所提供的小程序运行装置300设置为实现上述任一实施例所提供的小程序运行方法,相关描述可参见上述任一实施例的描述,此处不再赘述。
根据本公开的实施例,本公开还提供了一种电子设备、一种计算机可读介质和一种计算机程序产品。
图5为本公开实施例提供的一种电子设备的组成框图。
图5示出了可以用来实施本公开的实施例的电子设备500的示意性框图。该电子设备500旨在表示多种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备500还可以表示多种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本公开的实现。
参照图5,该电子设备500包括计算单元501,其可以根据存储在只读存储器(Read-Only Memory,ROM)502中的计算机程序或者从存储单元508加载到随机访问存储器(Random Access Memory,RAM)503中的计算机程序,来执行多种适当的动作和处理。在RAM 503中,还可存储电子设备500操作所需的多种程序和数据。计算单元501、ROM 502以及RAM 503通过总线504彼此相连。输入/输出(Input/Output,I/O)接口505也连接至总线504。
该电子设备500中的多个部件连接至I/O接口505,包括:输入单元506,例如键盘、鼠标等;输出单元507,例如多种类型的显示器、扬声器等;存储单元508,例如磁盘、光盘等;以及通信单元509,例如网卡、调制解调器、无线通信收发机等。通信单元509允许设备500通过诸如因特网的计算机网络和/或多种电信网络与其他设备交换信息/数据。
计算单元501可以是多种具有处理和计算能力的通用和/或专用处理组件。计算单元501的一些示例包括但不限于中央处理单元(Central Processing Unit,CPU)、图形处理单元(Graphics Processing Unit,GPU)、多种专用的人工智能(Artificial Intelligence,AI)计算芯片、多种运行机器学习模型算法的计算单元、数字信号处理器(Digital Signal Processor,DSP)、以及任何适当的处理器、控制器、微控制器等。计算单元501执行上文所描述的方法和处理,例如小程序运行方法。例如,在一些实施例中,上文描述的小程序运行方法可被实现为计算机软件程序或指令,其被有形地包含于机器(计算机)可读介质,例如存储单元508。在一些实施例中,计算机程序或指令的部分或者全部可以经由ROM502和/或通信单元509而被载入和/或安装到设备500上。当计算机程序或指令加载到RAM 503并由计算单元501执行时,可以执行上文描述的小程序运行方法的一个或多个步骤。备选地,在其他实施例中,计算单元501可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行上文描述的小程序运行方法。
本文中以上描述的系统和技术的多种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(Field Programmable Gate Array,FPGA)、专用集成电路(Application Specific Integrated Circuit,ASIC)、专用标准产品(Application Specific Standard Parts,ASSP)、芯片上系统的系统(System on Chip,SoC)、复杂可编程逻辑设备(Complex Programming Logic Device,CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些多种实施方式可以包括:实施在一个或者多个计算机程序或指令中,该一个或者多个计算机程序或指令可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。
用于实施本公开的方法的程序代码可以采用一个或多个编程语言的任何组合来编写。这些程序代码可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器或控制器,使得程序代码当由处理器或控制器执行时使流程图和/或框图中所规定的功能/操作被实施。程序代码可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机 器上执行或完全在远程机器或服务器上执行。
在本公开的上下文中,机器(计算机)可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的计算机程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:设置为向用户显示信息的显示装置(例如,阴极射线管(Cathode Ray Tube,CRT)或者液晶显示器(Liquid Crystal Display,LCD)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以设置为提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。
可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(Local Area Network,LAN)、广域网(Wide Area Network,WAN)和互联网。
计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。
本公开还提供了一种计算机程序产品,包括计算机程序,计算机程序在被处理器执行时实现上述小程序运行方法中任一项小程序运行方法。
根据本公开实施例的技术方案,响应于针对小程序的触发事件,通过向小程序服务器发送多个业务请求的方式来获取相应业务数据,并渲染相应业务数 据以呈现相应的小程序的内容。响应于针对小程序的触发事件,通过发送多个业务请求进行请求竞争,不仅能够降低请求返回失败的概率,有效确保了请求能够有效得到返回、响应,而且触发事件(如启动小程序事件或小程序页面跳转事件)的真实响应时间为响应时间最短的业务请求,在一定程度上降低了业务数据的响应时间,提升了业务数据的响应速度,从而有效提升了用户的体验度。在实际应用中,响应于针对小程序的启动事件,通过发送多个业务请求进行请求竞争,能够有效改善小程序的FMP时间,提升了小程序的性能。
可以使用上面所示的多种形式的流程,重新排序、增加或删除步骤。例如,本公开中记载的多步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本公开公开的技术方案所期望的结果,本文在此不进行限制。

Claims (12)

  1. 一种小程序运行方法,包括:
    响应于针对小程序的触发事件,向小程序服务器发送第一业务请求和至少一个第二业务请求;
    响应于接收到针对所述第一业务请求和所述至少一个第二业务请求中的一业务请求的请求响应消息,获取与所述一业务请求对应的业务数据;
    基于所述业务数据,渲染并加载所述业务数据对应的所述小程序的内容。
  2. 根据权利要求1所述的方法,在所述向小程序服务器发送第一业务请求和至少一个第二业务请求之前,还包括:
    识别所述小程序的小程序框架中的预设数据请求接口的接口参数是否包含预设请求参数;
    所述向小程序服务器发送第一业务请求和至少一个第二业务请求,包括:
    响应于识别出所述小程序框架中的预设数据请求接口的接口参数包含预设请求参数,向所述小程序服务器发送所述第一业务请求和所述至少一个第二业务请求。
  3. 根据权利要求2所述的方法,其中,所述向所述小程序服务器发送所述第一业务请求和所述至少一个第二业务请求,包括:
    调用所述预设数据请求接口向所述小程序服务器发送所述第一业务请求和所述至少一个第二业务请求。
  4. 根据权利要求2或3所述的方法,其中,所述向所述小程序服务器发送所述第一业务请求和所述至少一个第二业务请求,包括:
    向所述小程序服务器发送所述第一业务请求,并启动预设定时器;
    在所述预设定时器到期时,检查是否接收到所述小程序服务器针对所述第一业务请求返回的请求响应消息;
    在检查出未接收到针对所述第一业务请求的请求响应消息的情形下,向所述小程序服务器发送所述至少一个第二业务请求。
  5. 根据权利要求4所述的方法,其中,所述接口参数还包含与所述预设请求参数对应的请求延时控制参数;
    所述预设定时器为与所述请求延时控制参数对应的定时器。
  6. 根据权利要求4所述的方法,其中,所述接口参数还包含与所述预设请求参数对应的协议字段参数;
    所述向所述小程序服务器发送所述至少一个第二业务请求,包括:
    基于与所述协议字段参数对应的传输协议向所述小程序服务器发送所述至少一个第二业务请求。
  7. 根据权利要求6所述的方法,其中,所述协议字段参数包括超文本传输协议HTTP的协议字段参数或者基于用户数据报协议的低时延的互联网传输层协议QUIC的协议字段参数。
  8. 根据权利要求1所述的方法,在所述向小程序服务器发送第一业务请求和至少一个第二业务请求之后,还包括:
    响应于接收到针对所述第一业务请求的请求响应消息,取消所述至少一个第二业务请求的发送进程;或者,
    响应于接收到针对一第二业务请求的请求响应消息,取消所述第一业务请求的发送进程;且在所述至少一个第二业务请求的数量为多个的情形下,取消多个第二业务请求中除所述一第二业务请求外的第二业务请求的发送进程。
  9. 一种小程序运行装置,包括:
    请求发送模块,设置为响应于针对小程序的触发事件,向小程序服务器发送第一业务请求和至少一个第二业务请求;
    数据获取模块,设置为响应于接收到针对所述第一业务请求和所述至少一个第二业务请求中的一业务请求的请求响应消息,获取与所述一业务请求对应的业务数据;
    数据渲染模块,设置为基于所述业务数据,渲染并加载所述业务数据对应的所述小程序的内容。
  10. 一种电子设备,包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的至少一个指令,所述至少一个指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-8中任一项所述的小程序运行方法。
  11. 一种计算机可读介质,存储有计算机程序,其中,所述计算机程序被执行时实现如权利要求1-8中任一项所述的小程序运行方法。
  12. 一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现根据权利要求1-8中任一项所述的小程序运行方法。
PCT/CN2021/092041 2020-12-23 2021-05-07 小程序运行方法及装置、电子设备、介质 WO2022134425A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011539853.4A CN112540804A (zh) 2020-12-23 2020-12-23 小程序运行方法及装置、电子设备、介质
CN202011539853.4 2020-12-23

Publications (1)

Publication Number Publication Date
WO2022134425A1 true WO2022134425A1 (zh) 2022-06-30

Family

ID=75017649

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/092041 WO2022134425A1 (zh) 2020-12-23 2021-05-07 小程序运行方法及装置、电子设备、介质

Country Status (2)

Country Link
CN (1) CN112540804A (zh)
WO (1) WO2022134425A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112540804A (zh) * 2020-12-23 2021-03-23 北京百度网讯科技有限公司 小程序运行方法及装置、电子设备、介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170005981A1 (en) * 2014-03-17 2017-01-05 Huawei Technologies Co., Ltd. Address identifier allocation method, related device, and system
CN110007936A (zh) * 2019-04-16 2019-07-12 上海连尚网络科技有限公司 数据处理方法和装置
CN111586128A (zh) * 2020-04-28 2020-08-25 百度在线网络技术(北京)有限公司 小程序数据的获取方法、装置、设备以及存储介质
CN111767090A (zh) * 2020-06-28 2020-10-13 百度在线网络技术(北京)有限公司 小程序的启动方法、装置、电子设备以及存储介质
CN112052185A (zh) * 2020-09-29 2020-12-08 北京百度网讯科技有限公司 小程序的异常处理方法、装置、电子设备和存储介质
CN112540804A (zh) * 2020-12-23 2021-03-23 北京百度网讯科技有限公司 小程序运行方法及装置、电子设备、介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2673420C (en) * 2006-12-21 2015-10-20 Bce Inc. Systems and methods for conveying information to an instant messaging client
CN111200645B (zh) * 2019-12-27 2022-07-19 北京健康之家科技有限公司 业务请求处理方法、装置、设备及可读存储介质
CN111523102B (zh) * 2020-04-24 2023-10-27 腾讯科技(深圳)有限公司 小程序登录方法、装置、设备及计算机可读存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170005981A1 (en) * 2014-03-17 2017-01-05 Huawei Technologies Co., Ltd. Address identifier allocation method, related device, and system
CN110007936A (zh) * 2019-04-16 2019-07-12 上海连尚网络科技有限公司 数据处理方法和装置
CN111586128A (zh) * 2020-04-28 2020-08-25 百度在线网络技术(北京)有限公司 小程序数据的获取方法、装置、设备以及存储介质
CN111767090A (zh) * 2020-06-28 2020-10-13 百度在线网络技术(北京)有限公司 小程序的启动方法、装置、电子设备以及存储介质
CN112052185A (zh) * 2020-09-29 2020-12-08 北京百度网讯科技有限公司 小程序的异常处理方法、装置、电子设备和存储介质
CN112540804A (zh) * 2020-12-23 2021-03-23 北京百度网讯科技有限公司 小程序运行方法及装置、电子设备、介质

Also Published As

Publication number Publication date
CN112540804A (zh) 2021-03-23

Similar Documents

Publication Publication Date Title
JP6092381B2 (ja) ウェブクライアントを介したリモートアプリケーションへのアクセスを提供する方法、システム、及びコンピュータ読取可能記憶媒体
US9961129B2 (en) Business transaction correlation with client request monitoring data
US20200057658A1 (en) Method and system for loading resources
WO2022134428A1 (zh) 小程序页面渲染方法、装置、电子设备及存储介质
EP3813339A1 (en) Acquisition method, apparatus, device and storage medium for applet data
US9342333B2 (en) Backend custom code extensibility
US20110161989A1 (en) Dynamic program integration
US10635505B2 (en) Automated batch application programming interfaces
CN110413384B (zh) 延时任务处理方法及装置、存储介质、电子设备
US10606477B1 (en) Intelligent keyboard
WO2015176352A1 (zh) 一种基于安卓系统的应用间信息交互方法及装置
WO2022134425A1 (zh) 小程序运行方法及装置、电子设备、介质
CN111694620A (zh) 第三方业务的交互方法、装置、设备及计算机存储介质
CN110727523B (zh) 业务请求的处理方法、处理装置及可读存储介质
CN114748873A (zh) 界面渲染方法、装置、设备和存储介质
CN114035865A (zh) 启动小程序的方法、装置、设备以及存储介质
CN114490126A (zh) 页面处理方法、装置、电子设备和存储介质
KR20220063290A (ko) 애플릿 페이지 렌더링 방법, 장치, 전자 설비 및 저장 매체
CN112860566A (zh) 小程序检测方法、装置、电子设备以及可读介质
CN114090118B (zh) 启动小程序的方法、装置、设备以及存储介质
CN113641929B (zh) 页面渲染的方法、装置、电子设备和计算机可读存储介质
US11210205B2 (en) Application debugging
CN114510334A (zh) 类实例的调用方法、装置、电子设备及自动驾驶车辆
CN113950034A (zh) 蓝牙行为的模拟方法、装置和设备
CN112596729A (zh) 目标应用界面生成方法及装置、可读介质和电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21908436

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21908436

Country of ref document: EP

Kind code of ref document: A1