CN109117361B - Remote debugging method, related equipment and system for small program - Google Patents

Remote debugging method, related equipment and system for small program Download PDF

Info

Publication number
CN109117361B
CN109117361B CN201810642255.6A CN201810642255A CN109117361B CN 109117361 B CN109117361 B CN 109117361B CN 201810642255 A CN201810642255 A CN 201810642255A CN 109117361 B CN109117361 B CN 109117361B
Authority
CN
China
Prior art keywords
client
debugging
data information
applet
instruction message
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.)
Active
Application number
CN201810642255.6A
Other languages
Chinese (zh)
Other versions
CN109117361A (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201810642255.6A priority Critical patent/CN109117361B/en
Publication of CN109117361A publication Critical patent/CN109117361A/en
Application granted granted Critical
Publication of CN109117361B publication Critical patent/CN109117361B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software

Abstract

The invention discloses a remote debugging method, related equipment and a system of an applet, wherein the method is applied to a remote debugging system of the applet, the system at least comprises a first client, a transfer server and a second client, a view layer is deployed in the first client, and a logic layer is deployed in the second client; receiving a debugging instruction message which is transmitted by a transfer server and carries data information to be debugged; transferring the data information to be debugged to a logic layer so as to debug the logic layer to obtain debugging data information; acquiring debugging data information from the logic layer and packaging the debugging data information in a data packet; and sending the data packet to a transfer server so that the transfer server forwards the data packet to the first client, and updating page display according to the debugging data information by the view layer of the first client. The invention makes the debugging process environment closer to the actual running environment of the small program, makes the remote debugging become simple and improves the debugging efficiency of the small program.

Description

Remote debugging method, related equipment and system for small program
Technical Field
The invention relates to the technical field of computers, in particular to a remote debugging method of an applet, related equipment and a system.
Background
The applet is a mobile application program which is developed based on a specific programming language and can be used without downloading and installation, and can run on a cross-platform mobile client. The applet has the greatest characteristic of convenient use, and the user can open the application by scanning or searching without manually installing the applet in an operating system of the mobile terminal, so that the user does not need to worry about whether to install too many application programs.
At present, a framework structure of an applet generally includes two parts, namely a view layer and a logic layer, where the view layer is used to render a page structure, and the logic layer is used to perform logic processing, data request, and interface debugging. The view layer and the logic layer respectively run in two threads, the two are communicated through a native layer of the mobile client, the logic layer informs the view layer of data change through the native layer and triggers the update of a view layer page, the view layer informs the logic layer of a triggered event through the native layer for service processing, namely, the small program realizes the running effect through the separation of the view layer and the logic layer. For example, on the iOS client, the view layer renders the interface using wwebview and the logic layer performs the running of the logic code using JSCore, with data passing between them in response to user actions and updates to the interface.
In the prior art, debugging of applets is generally performed on a simulation machine, that is, a view layer, a logic layer and a mobile client native layer are all configured on the simulation machine, then the applets are run on the simulation machine for debugging, and the applets which are successfully debugged are then run on a mobile terminal.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems:
because the running environment of the simulator is different from that of the mobile terminal, the small program which is successfully debugged on the simulator still makes mistakes when running on the mobile terminal, so that the debugging process of the small program becomes more complicated, and the efficiency is greatly reduced.
Therefore, there is a need to provide a more reliable or efficient solution to enable easier and more efficient debugging of applets.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method, a related device, and a system for remotely debugging an applet. The technical scheme is as follows:
in one aspect, a method for remotely debugging an applet is provided, where the method is applied to a system for remotely debugging an applet, where the system at least includes a first client, a transit server, and a second client, where a view layer is deployed in the first client, and a logic layer is deployed in the second client, and for the second client, the method includes:
receiving a debugging instruction message forwarded by the transfer server, wherein the debugging instruction message carries information of data to be debugged; the debugging instruction message is generated by the first client end in response to a trigger event and is sent to the transfer server by the first client end;
transferring the data information to be debugged to the logic layer so that the logic layer debugs according to the data information to be debugged to obtain debugging data information;
acquiring the debugging data information from the logic layer and packaging the debugging data information in a data packet;
and sending the data packet to a transfer server so that the transfer server forwards the data packet to a first client, and updating page display according to the debugging data information by a view layer of the first client.
In another aspect, a method for remotely debugging an applet is provided, where the method is applied to a system for remotely debugging an applet, and the system includes at least a first client, a transit server, and a second client, where a view layer is deployed in the first client, and a logic layer is deployed in the second client, and for the first client, the method includes:
responding to a trigger event, and generating a debugging instruction message, wherein the debugging instruction message carries information of data to be debugged;
sending the debugging instruction message to a transfer server so that the transfer server forwards the debugging instruction message to a second client, wherein the second client is used for receiving the debugging instruction message and transferring the debugging instruction message to the logic layer so that the logic layer is debugged according to the data information to be debugged to obtain debugging data information; acquiring the debugging data information from the logic layer and packaging the debugging data information in a data packet; sending the data packet to a transit server so that the transit server forwards the data packet;
receiving and analyzing the data packet forwarded by the transit server to obtain the debugging data information;
and transferring the debugging data information to the view layer so that the view layer updates the page display according to the debugging data information.
In another aspect, a method for remotely debugging an applet is provided, where the method is applied to a system for remotely debugging an applet, and the system includes at least a first client, a transit server, and a second client, where a view layer is deployed in the first client, and a logic layer is deployed in the second client, and for the transit server, the method includes:
receiving a debugging instruction message sent by the first client, wherein the debugging instruction message carries information of data to be debugged; the first client is used for responding to a trigger event, generating a debugging instruction message and sending the debugging instruction message;
forwarding the debugging instruction message to the second client; the second client is used for receiving the debugging instruction message; transferring the data information to be debugged to the logic layer so that the logic layer debugs according to the data information to be debugged to obtain debugging data information; and acquiring the debugging data information from the logic layer, packaging the debugging data information in a data packet and sending the data packet.
Receiving a data packet sent by the second client;
and forwarding the data packet to the first client side so that a view layer of the first client side updates page display according to the debugging data information.
On the other hand, a second client is provided, where a logic layer is deployed in the second client, the second client is applied to a remote debugging system of an applet, the remote debugging system of the applet at least further includes a transit server and a first client, a view layer is deployed in the first client, and the second client includes:
the first receiving module is used for receiving the debugging instruction message forwarded by the transfer server, wherein the debugging instruction message carries the information of data to be debugged; the debugging instruction message is generated by the first client end in response to a trigger event and is sent to the transfer server by the first client end;
the first transfer module is used for transferring the data information to be debugged to the logic layer so that the logic layer is debugged according to the data information to be debugged to obtain debugging data information;
the encapsulation module is used for acquiring the debugging data information from the logic layer and encapsulating the debugging data information in a data packet;
and the first sending module is used for sending the data packet to a transfer server so that the transfer server forwards the data packet to a first client, and a view layer of the first client updates page display according to the debugging data information.
In another aspect, a first client is provided, where a view layer is deployed in the first client, the first client is applied to a remote debugging system of an applet, the remote debugging system of the applet at least further includes a transit server and a second client, a logic layer is deployed in the second client, and the first client includes:
the generating module is used for responding to a trigger event and generating a debugging instruction message, wherein the debugging instruction message carries the information of data to be debugged;
a second sending module, configured to send the debug instruction message to a transit server, so that the transit server forwards the debug instruction message to a second client, where the second client is configured to receive the debug instruction message and transfer the debug instruction message to the logic layer, so that the logic layer performs debugging according to the to-be-debugged data information to obtain debug data information; acquiring the debugging data information from the logic layer and packaging the debugging data information in a data packet; sending the data packet to a transit server so that the transit server forwards the data packet;
the second receiving module is used for receiving and analyzing the data packet forwarded by the transit server to obtain the debugging data information;
and the second transfer module is used for transferring the debugging data information to the view layer so that the view layer updates page display according to the debugging data information.
On the other hand, a transit server is provided, where the transit server is applied to a remote debugging system of an applet, the remote debugging system of the applet at least further includes a first client and a second client, a view layer is deployed in the first client, a logic layer is deployed in the second client, and the transit server includes:
the third receiving module is used for receiving a debugging instruction message sent by the first client, wherein the debugging instruction message carries information of data to be debugged; the first client is used for responding to a trigger event, generating a debugging instruction message and sending the debugging instruction message;
the first forwarding module is used for forwarding the debugging instruction message to the second client; the second client is used for receiving the debugging instruction message; transferring the data information to be debugged to the logic layer so that the logic layer debugs according to the data information to be debugged to obtain debugging data information; and acquiring the debugging data information from the logic layer, packaging the debugging data information in a data packet and sending the data packet.
A fourth receiving module, configured to receive the data packet sent by the second client;
and the second forwarding module is used for forwarding the data packet to the first client so as to update the page display of the view layer of the first client according to the debugging data information.
In another aspect, a remote debugging system for an applet is provided, where the system at least includes a first client, a transit server, and a second client, where a view layer is deployed in the first client, and a logic layer is deployed in the second client;
the first client is used for responding to a trigger event and generating a debugging instruction message, wherein the debugging instruction message carries information of data to be debugged; sending the debugging instruction message to a transfer server; receiving and analyzing the data packet forwarded by the transit server to obtain the debugging data information; transferring the debugging data information to the view layer so that the view layer updates page display according to the debugging data information;
the transit server is used for receiving the debugging instruction message sent by the first client; forwarding the debugging instruction message to the second client; receiving a data packet sent by the second client; forwarding the data packet to the first client;
the second client is used for receiving the debugging instruction message forwarded by the transit server; transferring the data information to be debugged to the logic layer so that the logic layer debugs according to the data information to be debugged to obtain debugging data information; acquiring the debugging data information from the logic layer and packaging the debugging data information in a data packet; and sending the data packet to a transit server.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the invention deploys the logic layer of the applet at a second client (namely a debugging client) by virtue of the characteristic that the view layer and the logic layer of the applet are separated, deploys the view layer at a first client (namely a debugged mobile terminal), and performs information transfer and caching through a transfer server, so that the environment of the debugging process is closer to the actual running environment of the applet, the remote debugging of the applet is realized, the remote debugging becomes extremely simple, a developer hardly senses the middle process in the debugging process, and the debugging efficiency of the applet is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a system architecture diagram for remote debugging of applets provided by embodiments of the present invention;
fig. 2 is a schematic flowchart of a method for remotely debugging an applet according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a method for transferring the data information to be debugged to the logic layer by the second client according to the embodiment of the present invention;
fig. 4 is a flowchart illustrating a method for encapsulating the debug data information in a data packet by the second client according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating another method for remotely debugging an applet according to an embodiment of the present invention;
fig. 6 is a flowchart illustrating a method for generating a debug instruction message by a first client in response to a trigger event according to an embodiment of the present invention;
FIG. 7 is a flowchart illustrating another method for remotely debugging an applet according to an embodiment of the present invention;
fig. 8 is a flowchart illustrating a method for transferring the debug data information to the view layer by the first client according to an embodiment of the present invention;
FIG. 9 is a flowchart illustrating another method for remotely debugging an applet according to an embodiment of the present invention;
fig. 10 is a flowchart illustrating a method for authenticating the validity of the transit server according to an embodiment of the present invention;
fig. 11 is a schematic structural diagram of a second client according to an embodiment of the present invention;
fig. 12 is a schematic structural diagram of a package module according to an embodiment of the present invention;
fig. 13 is a schematic structural diagram of a first transfer module according to an embodiment of the present invention;
fig. 14 is a schematic structural diagram of a first client according to an embodiment of the present invention;
fig. 15 is a schematic structural diagram of another first client according to an embodiment of the present invention
Fig. 16 is a schematic structural diagram of a second transfer module provided in the embodiment of the present invention;
fig. 17 is a schematic structural diagram of a first generating module according to an embodiment of the present invention;
fig. 18 is a schematic structural diagram of a transit server according to an embodiment of the present invention;
fig. 19 is a schematic structural diagram of another transit server according to an embodiment of the present invention;
fig. 20 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
The embodiment of the invention provides a remote debugging method, related equipment and system of an applet, wherein by means of the characteristic that a view layer and a logic layer of the applet are separated, the view layer of the applet is still deployed at a mobile terminal, the logic layer of the applet is transferred and deployed to a debugging client, and information is transferred and cached through a transfer server, so that the environment in the debugging process is closer to the actual running environment of the applet, the remote debugging of the applet is realized, the remote debugging becomes abnormally simple, a developer hardly perceives an intermediate process in the debugging process, and the debugging efficiency of the applet is improved.
It should be understood that the present invention is applied to a remote debugging system of an applet, and please refer to fig. 1, which is a diagram illustrating a system architecture for remote debugging of an applet according to an embodiment of the present invention. As shown in fig. 1, the remote debugging system of the applet includes a first client 100, a second client 200 and a relay server 300, and the first client 100 and the second client 200 forward information and cache information through the relay server 300. The first client 100 may be an application installed in an operating system of the mobile terminal, and the mobile terminal may be a mobile phone, an IPAD, or the like. The second client 200 may be a debugging platform installed in a Personal Computer (PC), such as a developer tool.
It should be noted that, in the embodiment of the present invention, a view layer of an applet is deployed in the first client 100, and a logic layer of the applet is deployed in the second client 200, where the view layer and the logic layer are respectively deployed on different clients, but data transmission between the view layer and the logic layer still needs to be performed through a native layer of a mobile client (i.e., the first client), that is, the logic layer needs to notify a change of data to the view layer through the native layer to trigger a page update of the view layer, and the view layer needs to notify a triggered event to the logic layer through the native layer to perform service processing.
In addition, the logic layer deployed on the second client 200 may create a Virtual Machine (VM) on the second client, for example, a Virtual execution environment on the developer tool, which is independent and isolated from the outside world, and may be used to run the logic code written by the applet developer. The logic layer and the second client 200 may perform information transmission through a WebSocket transmission channel. The view layer deployed on the first client 100 may be page exposed, which is written by a WXML compiler and a WXSS compiler and is exposed by a component.
In addition, the relay server 300 may establish communication connections with the first client 100 and the second client 200 through networks, respectively, where the network between the relay server 300 and the first client 100 and the network between the relay server 300 and the second client 200 may be the same network segment of the local area network or different network segments of the local area network.
The remote debugging method of the applet in the present invention is described below from the perspective of a second client, i.e., a debugging client.
Referring to fig. 2, which is a flow chart illustrating a method for remotely debugging an applet according to an embodiment of the present invention, the present specification provides the method operation steps as described in the embodiment or the flow chart, but may include more or less operation steps based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In actual system or end product execution, sequential execution or parallel execution (e.g., parallel processor or multi-threaded environment) may be possible according to the embodiments or methods shown in the figures. Specifically, as shown in fig. 2, the method includes:
and S202, receiving a debugging instruction message forwarded by the transit server, wherein the debugging instruction message carries information of data to be debugged.
In this embodiment of the present specification, the first client may generate a debug instruction message in response to a trigger event, where the trigger event may be a click operation or a sliding operation of a user on a view layer of the first client, and the above operation may be captured by WebView on the view layer, and then the view layer transmits data information corresponding to the captured operation to the first client, specifically, to a native layer of the first client, and the first client generates the debug instruction message according to data transmitted by the view layer, where the debug instruction message includes data information to be debugged.
After generating the debug instruction message, the first client may send the debug instruction message to the transit server, so that the transit server forwards the debug instruction message to the second client.
In this embodiment of the present specification, before receiving the debug instruction message forwarded by the relay server, the second client may send a WebSocket connection request to the relay server, and receive the debug instruction message sent by the relay server through the WebSocket transmission channel when the WebSocket transmission channel is established according to the WebSocket connection request.
S204, transferring the data information to be debugged to the logic layer so that the logic layer debugs according to the data information to be debugged to obtain debugging data information.
In this embodiment of the present specification, the second client parses the received debug instruction message, obtains data information to be debugged, and transfers the data information to be debugged to the deployed logic layer. The logic adjustment of the data information to be debugged can be realized in the logic layer, and the adjusted logic is operated, so that the debugging data information is obtained.
Specifically, a WebSocket transmission channel may be established between the second client and the logic layer, and the second client transmits the data information to be debugged to the logic layer through the WebSocket transmission channel.
In this embodiment of the present specification, the data information to be debugged generated by operating the view layer may be used to update the view layer, or may also be some calls to the native layer function of the first client, and the like, for the data information to be debugged used to update the view layer, processing of the logic layer of the second client is required, and for some data information to be debugged calling the native layer function of the first client, processing may be performed only in the local area of the second client, and therefore, the category of the data information to be debugged needs to be further distinguished.
In this embodiment of the present specification, the debug instruction message may further include a first category tag for indicating a category of the data information to be debugged, where the category of the data information to be debugged includes at least updating the view layer. Specifically, a flow of the method for transferring the data information to be debugged to the logic layer is shown in fig. 3, and may include:
s302, obtaining the first category label.
Specifically, the debug instruction message includes data information to be debugged and a first class tag used for indicating a class of the data information to be debugged. The second client analyzes the received debugging instruction message, and can obtain the data information to be debugged and a first class label used for indicating the class of the data information to be debugged.
S304, determining the category of the data information to be debugged according to the first category label.
Specifically, the second client may determine whether the data information to be debugged is to update the view layer through the first category tag.
S306, when the type of the data information to be debugged is to update the view layer, transferring the data information to be debugged to the logic layer.
Specifically, when the second client determines that the type of the data information to be debugged is the update view layer, the data information to be debugged may be transmitted to the logic layer through the WebSocket transmission channel; when the second client determines that the type of the data information to be debugged is not the update view layer, the data information to be debugged can be directly processed locally.
In addition, in this embodiment of the present specification, when the logic layer performs debugging according to the data information to be debugged to obtain the debug data information, the category of the debug data information may also be obtained through a related analysis logic written by a developer, so as to print a second category tag for indicating the category of the debug data information on the debug data information, where the category of the debug data information at least includes updating the view layer, and for example, the category of the debug data information may also include invoking native capability of the first client.
S206, obtaining the debugging data information from the logic layer, and packaging the debugging data information in a data packet.
In this embodiment, the second client may obtain the debug data information from the logic layer through the WebSocket transmission channel, and then encapsulate the debug data information into a data packet for transmission.
In order to prevent the occurrence of a packet loss occurring in transmission and a logical confusion phenomenon occurring when the first client executes on the packet, in an embodiment of the present specification, a flow of a method for encapsulating the debug data information in the packet is shown in fig. 4, and may include:
s402, setting corresponding serial numbers for the debugging data information according to the debugging data information acquisition sequence.
In this embodiment of the present specification, each time the second client acquires the debug data information, the second client sets a corresponding serial number for each debug data information according to the order of acquiring the debug information. The serial number may be an arabic number or other identifier capable of indicating the sequence.
S404, generating a first time interval corresponding to the debugging data information according to the debugging data information and the obtaining time interval of the debugging data information of the adjacent serial numbers.
In this embodiment of the present specification, a first time interval of the first debug data information acquired by the second client may be set to 0, and a first time interval of the subsequently acquired debug data information may be determined according to an interval between the first time interval and the acquisition time of the debug data information of the previous serial number. Specifically, the second client may record an acquisition timestamp of each piece of debug data information, calculate a difference between the timestamp of the current piece of debug data information and the timestamp of the previous piece of debug data information, and use the difference as a first time interval of the currently acquired piece of debug data information.
S406, the debugging data information, the sequence number corresponding to the debugging data information and the first time interval are packaged in a data packet.
In this embodiment of the present description, since the data packet is forwarded to the first client through the relay server, in order to reduce the load of the relay server, when the data packet is encapsulated, the data packet may be encapsulated into an inner layer and an outer layer, where the outer layer may be only understood by the relay server, and the inner layer is understood content of the first client and the second client. In practical application, the serial number corresponding to the debugging data information can be packaged in an outer layer for being analyzed by a subsequent transit server; the debugging data information and the corresponding first time interval can be packaged in the inner layer for the subsequent analysis of the first client.
And S208, sending the data packet to a transfer server so that the transfer server forwards the data packet to a first client, and updating page display by a view layer of the first client according to the debugging data information.
In this embodiment, while the second client sends the data packet to the relay server, the second client may also store the corresponding data packet locally and at the same time, so as to prevent the data packet from being lost during transmission.
In one example, after the second client sends the data packet to the transit server, the second client may further receive a first data packet confirmation message sent by the transit server, determine, according to the first data packet confirmation message, the data packet that has been received by the transit server, and then delete, from the local storage medium, the data packet that has been received by the transit server. For the data packets that are not received by the relay server, the second client may send the part of the data packets that are not received by the relay server to the relay server again according to a preset time interval until the data packet acknowledgement message of the part of the data packets sent by the relay server is received, for example, the second client may actively send the unacknowledged data packets to the relay server every 10 to 15 seconds. The second client actively searches the data packet which is not received by the transit server and sends the data packet to the transit server again, so that the processing pressure of the transit server in the system can be greatly reduced.
In this embodiment, by means of the characteristic that the view layer and the logic layer of the applet are separated, the logic layer is deployed at a second client (i.e., a debugging client), the view layer is deployed at a first client (i.e., a debugged mobile terminal), and information is transferred and cached through a transfer server, so that the environment of the debugging process is closer to the actual operating environment of the applet, the remote debugging of the applet is realized, the remote debugging becomes abnormally simple, a developer hardly perceives the middle process in the debugging process, and the debugging efficiency of the applet is improved.
The above embodiment describes the remote debugging method of the applet in the present invention from the perspective of the second client (i.e., the debugging client), and the remote debugging method of the applet in the present invention will be described from the perspective of the first client (i.e., the debugged mobile).
Referring to fig. 5, which is a flow chart illustrating another method for remotely debugging an applet according to an embodiment of the present invention, the present specification provides the method operation steps as described in the embodiment or the flow chart, but may include more or less operation steps based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In actual system or end product execution, sequential execution or parallel execution (e.g., parallel processor or multi-threaded environment) may be possible according to the embodiments or methods shown in the figures. Specifically, as shown in fig. 5, the method includes:
s502, responding to a trigger event, and generating a debugging instruction message, wherein the debugging instruction message carries information of data to be debugged.
In this embodiment of the present specification, the first client may generate a debug instruction message in response to a trigger event, where the trigger event may be a click operation or a sliding operation of a user on a view layer of the first client, and the above operation may be captured by WebView on the view layer, and then the view layer transmits data information corresponding to the captured operation to the first client, specifically, to a native layer of the first client, and the first client generates the debug instruction message according to data transmitted by the view layer, where the debug instruction message includes data information to be debugged.
Specifically, the flow of the method for the first client to generate the debug instruction message in response to the trigger event may be as shown in fig. 6, and includes:
s602, the category of the data information to be debugged is obtained according to the trigger event.
In this specification embodiment, the category of the data information to be debugged includes at least the update view layer, which may also include some calls to the first client native layer function, for example, and so on.
S604, generating a first class label for indicating the class of the data information to be debugged according to the class of the data information to be debugged.
S606, the debugging instruction message is generated according to the data information to be debugged and the first class label.
S504, the debugging instruction message is sent to a transit server.
In this embodiment, after generating the debug instruction message, the first client may send the debug instruction message to the transit server, so that the transit server forwards the debug instruction message to the second client. The second client may process the debug instruction message according to the method shown in fig. 2, and send the encapsulated data packet to the transit server.
In this embodiment of the present specification, before sending the debug instruction message to the relay server, the first client may send a WebSocket connection request to the relay server, and when a WebSocket transmission channel is established according to the WebSocket connection request, send the debug instruction message to the relay server through the WebSocket transmission channel.
S506, receiving and analyzing the data packet forwarded by the transit server.
In this embodiment, the data packet forwarded by the transit server may include debug data information, and may further include a sequence number and a first time interval corresponding to the debug data information. The first client analyzes the data packet to obtain the debug data information in the data packet, and of course, a sequence number and a first time interval corresponding to the debug data information may also be obtained.
S508, the debugging data information is transferred to the view layer, so that the view layer updates page display according to the debugging data information.
In practical application, the second client and the relay server, and the relay server and the first client are connected and communicated through a network, and due to the limitation of network quality, it cannot be guaranteed that a data packet sent by the second client first can reach the first client first, and generally, the first client is a multi-thread received message, and the reception is received out of order, so that the first client needs to determine the execution time of each data packet before executing debugging data information in the data packet, so as to prevent logic confusion during execution.
Specifically, as shown in fig. 7, before the debugging data information is transferred to the view layer, the method further includes:
s702, a serial number and a first time interval corresponding to the debugging data information are obtained.
S704, sorting the debugging data information according to the sequence number.
The first client may sort the debug data information according to the serial number according to a preset sorting rule. For example, the debug data information may be ordered sequentially by sequence number.
S706, a second time interval between the time of executing the last debugging data information and the current time is obtained.
In this specification embodiment, the first client may record an execution timestamp of the debug data information when executing the debug data information. When new debugging data information is acquired, a time interval between the execution time stamp of the last executed debugging data information and the time stamp of the current time can be acquired according to the difference value of the execution time stamp of the last executed debugging data information and the time stamp of the current time, and the time interval is used as a second time interval.
S708, determining to execute the debugging data information according to the first time interval and the second time interval.
Specifically, when the first time interval does not exceed the second time interval, it is determined that the corresponding debug data information can be currently executed. Otherwise, if the first time interval exceeds the second time interval, it indicates that the time for executing the corresponding debug data information does not yet come, and the wait needs to be continued.
For example, for convenience of description, the data packets are denoted as a "serial number" and a "first time interval", the first client receives the data packets [ 1, 5ms ], [ 3, 100ms ], and [ 2, 20ms ], and the first client is ordered according to the serial numbers to be [ 1, 5ms ], [ 2, 20ms ], [ 3, 100ms ]; the difference between the execution timestamp of the debug data information executed last by the first client and the timestamp of the current time, i.e. the second time interval, is 10 ms. Since 5ms <10ms, the first client may currently execute the corresponding debug data information of the data packet [ 1, 5ms ]. Since the first time intervals of the data packets [ 2, 20ms ] and [ 3, 100ms ] are both greater than 10ms, the first client can determine the corresponding debugging data information of the data packets [ 2, 20ms ] after 20ms, and execute the corresponding debugging data information of the data packets [ 3, 100ms ] after 100ms, thereby well determining the execution time point corresponding to each piece of debugging data information and preventing logic confusion during execution.
In addition, in order to prevent the data packets from being lost during the transmission from the relay server to the first client, the first client may send a second data packet confirmation message to the relay server after sorting the debug data information, and the relay server determines the data packets that are not received by the first client according to the second data packet confirmation message and sends the part of the data packets that are not received by the first client to the first client again.
In practical application, the serial number corresponding to the debug data information may be an arabic number, and then the first client may sort the debug data information according to the consecutive serial numbers and send the serial number with the largest consecutive serial number to the relay server, and the relay server determines, according to the serial number with the largest consecutive serial number, that all debug data information corresponding to the serial number before the serial number has been received by the first client, thereby determining a packet that is not received by the first client, and sending the part of data to the first client again.
For example, if the sequence numbers corresponding to the sequenced packets currently received by the first client are 1,2,3, and 6, then the sequence number with the largest continuous sequence number is 3, the first client sends the sequence number 3 to the relay server, and the relay server confirms that the packets 1,2, and 3 have been received by the first client according to the sequence number 3, so as to send the packets corresponding to the remaining sequence numbers to the first client again.
In this embodiment of the present specification, the debug data information parsed by the first client includes a second category tag used for indicating a category of the debug data information, where the category of the debug data information at least includes updating the view layer, for example, the category of the debug data information may further include invoking a native capability of the first client. Then, a flow of the method for the first client to transfer the debugging data information to the view layer is shown in fig. 8, and may include:
s802, obtaining the second category label.
S804, determining the category of the debugging data information according to the second category label.
Specifically, the first client may determine whether the category of the debug data information is the update map layer according to the second category tag.
S806, when the type of the debugging data information is that the view layer is updated, transferring the debugging data information to the view layer.
Specifically, when the first client determines that the type of the debugging data information is the update view layer, the debugging data information may be transferred to the view layer, so that the view layer performs page display update according to the debugging data information; when the first client determines that the category of the debugging data information is not the update view layer, the executed action may be determined according to the category of the debugging data information, for example, the native capability of the first client may be invoked.
In this embodiment, by means of the characteristic that the view layer and the logic layer of the applet are separated, the logic layer is deployed at a second client (i.e., a debugging client), the view layer is deployed at a first client (i.e., a debugged mobile terminal), and information is transferred and cached through a transfer server, so that the environment of the debugging process is closer to the actual operating environment of the applet, the remote debugging of the applet is realized, the remote debugging becomes abnormally simple, a developer hardly perceives the middle process in the debugging process, and the debugging efficiency of the applet is improved.
The above embodiments describe the remote debugging method of the applet in the present invention from the perspective of the second client (i.e., the debugging client) and the first client (i.e., the debugged mobile), respectively, and the remote debugging method of the applet in the present invention will be described below from the perspective of the relay server.
Referring to fig. 9, which is a flow chart illustrating another method for remotely debugging an applet according to an embodiment of the present invention, the present specification provides the method operation steps as described in the embodiment or the flow chart, but may include more or less operation steps based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In practice, the system or server product may be implemented in a sequential or parallel manner (e.g., parallel processor or multi-threaded environment) according to the embodiments or methods shown in the figures. Specifically, as shown in fig. 9, the method includes:
and S902, receiving a debugging instruction message sent by the first client, wherein the debugging instruction message carries information of data to be debugged.
In this embodiment, the first client may generate a debug instruction message according to the method shown in fig. 5 and send the debug instruction message to the transit server.
In addition, in this embodiment of this specification, in order to ensure the validity of debugging between the debugging party and the debuggee, before receiving the debugging instruction message sent by the first client, validity authentication needs to be performed, specifically, a method shown in fig. 10 may be adopted, where the method may include:
s1002, acquiring a first WebSocket connection request sent by the first client, wherein the first WebSocket connection request carries the identity of the first client.
In this embodiment, the identity of the first client may be account information for logging in the first client.
And S1004, acquiring a second WebSocket connection request sent by the second client, wherein the second WebSocket connection request carries the identity of the second client.
In this embodiment, the identity of the second client may be account information for logging in the second client.
S1006, determine whether the identity of the first client matches the identity of the second client.
S1008, when the identity of the first client is matched with the identity of the second client, a WebSocket transmission channel is established.
In this embodiment of the present specification, when the identity of the first client matches the identity of the second client, it indicates that the current debugging is legal, and may receive, through the established WebSocket transmission channel, a debugging instruction message sent by the first client, so as to start a debugging process.
Through the validity identification, the second client can be ensured to be the first client corresponding to the corresponding logic layer, and the debugging of other debugged objects is avoided.
S904, forwarding the debug instruction message to the second client.
In this embodiment, the second client may process the debug instruction message according to the method shown in fig. 2, and send the encapsulated data packet to the transit server.
S906, receiving the data packet sent by the second client.
In this embodiment of the present specification, the data packet sent by the second client may include an inner layer and an outer layer, where the outer layer may be only understood by the transit server, and the inner layer is content understood by the first client and the second client. In practical application, the serial number corresponding to the debugging data information can be packaged in an outer layer for being analyzed by a subsequent transit server; the debugging data information and the corresponding first time interval can be packaged in the inner layer for the subsequent analysis of the first client.
In order to prevent the data packet loss from occurring during the transmission between the second client and the relay server, the relay server may send a first data packet acknowledgement message to the second client after receiving the data packet, so that the second client determines the data packet that is not received by the relay server according to the first data packet acknowledgement message, and sends the part of the data packet that is not received by the relay server to the relay server again, so that the relay server receives the part of the data packet.
In practical application, after receiving the data packet, the transit server may analyze the data packet to obtain a sequence number encapsulated in an outer layer of the data packet, and sequence the data packet according to the sequence number. Specifically, the consecutive sequence may be performed according to the sequence numbers, then the largest sequence number in the consecutive sequence numbers is sent to the second client, the second client may determine, according to the largest sequence number, that the data packet corresponding to the sequence number before the sequence number has been received by the relay server, determine that the data packet corresponding to the sequence number after the sequence number has not been received by the relay server, and send the part of the data packet to the relay server again, after the relay server receives the data packet sent again by the second client, the sequence is repeated, and the first data packet acknowledgement message is sent until all the data packets within the preset time period are received by the relay server.
S908, forward the data packet to the first client, so that the view layer of the first client updates the page display according to the debugging data information.
In this embodiment, after determining that all the data packets within the preset time period are received, the transit server may send the data packets to the first client according to the sequence of the sequence numbers.
It should be noted that, in the embodiment of the present specification, the transit server may arrange to send the data packet according to the network condition. For example, when the current network condition is not good, the received data packet may be cached first, and when the network condition is good, the cached data packet is sent to the first client.
In this embodiment, in order to prevent the packet loss during the transmission between the relay server and the first client, the relay server may receive a second packet acknowledgement message sent by the first client, determine, according to the second packet acknowledgement message, a packet that is not received by the first client, and send the portion of the packet that is not received by the first client to the first client again.
In practical application, the first client may sequence the debug data information according to the consecutive sequence numbers, and send the sequence number with the largest consecutive sequence number to the relay server, and the relay server determines, according to the sequence number with the largest consecutive sequence number, that all debug data information corresponding to the sequence number before the sequence number has been received by the first client, thereby determining a data packet that has not been received by the first client, and sends the part of data to the first client again.
In this embodiment of the present specification, after the transit server determines that the first client has received all the data packets within the preset time period, the corresponding data packets cached in the transit server may be deleted.
In this embodiment, through the transfer and the cache of the transfer server, even if the network environment is severe, the secure arrival of data can be ensured, the loss of a transmission process data packet is well prevented, and the restriction of a local area network and the restriction of a USB data line can be broken through the transfer server.
In addition, in this embodiment, by means of the characteristic that the view layer and the logic layer of the applet are separated, the logic layer is deployed at the second client (i.e., the debugging client), the view layer is deployed at the first client (i.e., the debugged mobile terminal), and information is transferred and cached through the transfer server, so that the environment of the debugging process is closer to the actual operating environment of the applet, the remote debugging of the applet is realized, the remote debugging becomes abnormally simple, a developer hardly perceives the middle process in the debugging process, and the debugging efficiency of the applet is improved.
Referring to fig. 11, in the embodiment of the present invention, a logic layer is deployed in a second client, where the second client is applied to a remote debugging system of an applet, the remote debugging system of the applet at least further includes a transit server and a first client, and a view layer is deployed in the first client. The second client has a function of implementing the second client side in the foregoing method embodiment, where the function may be implemented by hardware, or may be implemented by hardware executing corresponding software, and specifically, the second client may include:
a first receiving module 1110, configured to receive a debugging instruction message forwarded by the transit server, where the debugging instruction message carries information of data to be debugged; the debugging instruction message is generated by the first client end in response to a trigger event and is sent to the transfer server by the first client end;
a first transfer module 1120, configured to transfer the data information to be debugged to the logic layer, so that the logic layer performs debugging according to the data information to be debugged, to obtain debug data information;
in one example, the debug data information includes a second category tag for indicating a category of the debug data information, the category of the debug data information including at least updating the view layer.
A packaging module 1130, configured to obtain the debug data information from the logic layer, and package the debug data information in a data packet;
a first sending module 1140, configured to send the data packet to a transit server, so that the transit server forwards the data packet to a first client, and a view layer of the first client updates page display according to the debugging data information.
Alternatively, as shown in fig. 12, the package module 1130 may include:
a serial number setting module 1131, configured to set a corresponding serial number for the debug data information according to the order of obtaining the debug data information;
a second generating module 1132, configured to generate a first time interval corresponding to the debug data information according to the debug data information and an acquisition time interval of the debug data information of an adjacent serial number;
the encapsulating sub-module 1133 is configured to encapsulate the debug data information, a sequence number corresponding to the debug data information, and a first time interval in a data packet.
In an example, the debugging instruction message further includes a first class tag used for indicating a class of the data information to be debugged, where the class of the data information to be debugged at least includes updating the view layer, and accordingly, as shown in fig. 13, the first transfer module 1120 may include:
a first obtaining module 1121, configured to obtain the first category tag;
a first determining module 1122, configured to determine the category of the data information to be debugged according to the first category tag;
the first transfer sub-module 1123 is configured to transfer the data information to be debugged to the logic layer when the type of the data information to be debugged is to update the view layer.
Referring to fig. 14, a view layer is deployed in a first client in an embodiment of the present invention, where the first client is applied to a remote debugging system of an applet, the remote debugging system of the applet at least further includes a transit server and a second client, and a logic layer is deployed in the second client. The first client has a function of implementing the first client side in the foregoing method embodiment, where the function may be implemented by hardware, or may be implemented by hardware executing corresponding software, and specifically, the first client may include:
a first generating module 1410, configured to generate, in response to a trigger event, a debugging instruction message, where the debugging instruction message carries information of data to be debugged;
a second sending module 1420, configured to send the debug instruction message to a transit server, so that the transit server forwards the debug instruction message to a second client, where the second client is configured to receive the debug instruction message, and transfer the debug instruction message to the logic layer, so that the logic layer performs debugging according to the to-be-debugged data information, to obtain debug data information; acquiring the debugging data information from the logic layer and packaging the debugging data information in a data packet; sending the data packet to a transit server so that the transit server forwards the data packet;
a second receiving module 1430, configured to receive and analyze the data packet forwarded by the transit server, so as to obtain the debug data information;
the second transferring module 1440 is configured to transfer the debugging data information to the view layer, so that the view layer updates page display according to the debugging data information.
In an example, the data packet further includes a sequence number and a first time interval corresponding to the debug data information, and accordingly, as shown in fig. 15, the first client may further include:
a second obtaining module 1450, configured to obtain a sequence number and a first time interval corresponding to the debug data information;
a sorting module 1460, configured to sort the debug data information according to the serial number;
a third obtaining module 1470, configured to obtain a second time interval between the time of executing the last debug data message and the current time;
a second determining module 1480 is configured to determine to execute the debugging data information according to the first time interval and the second time interval.
In another example, the debugging data information includes a second category tag indicating a category of the debugging data information, where the category of the debugging data information includes at least updating the view layer, and accordingly, as shown in fig. 16, the second transferring module 1440 may include:
a fourth obtaining module 1441, configured to obtain the second category label;
a third determining module 1442, configured to determine a category of the debug data information according to the second category label;
a second transfer sub-module 1443, configured to transfer the debugging data information to the view layer when the type of the debugging data information is to update the view layer.
In another example, as shown in fig. 17, the first generation module 1410 may include:
a fifth obtaining module 1411, configured to obtain the category of the data information to be debugged according to the trigger event;
the first generation submodule 1412 is configured to generate a first class tag used for indicating the class of the data information to be debugged according to the class of the data information to be debugged;
the second generating submodule 1413 is configured to generate the debugging instruction message according to the to-be-debugged data information and the first class tag; and updating the view layer according to the category of the data information to be debugged.
Referring to fig. 18, the transit server in the embodiment of the present invention is applied to a remote debugging system of an applet, where the remote debugging system of the applet further includes at least a first client and a second client, the first client is disposed with a view layer, and the second client is disposed with a logic layer. The relay server has a function of implementing the relay server side in the above method embodiment, where the function may be implemented by hardware, or may be implemented by hardware executing corresponding software, and specifically, the relay server may include:
a third receiving module 1810, configured to receive a debugging instruction message sent by the first client, where the debugging instruction message carries information of data to be debugged;
a first forwarding module 1820, configured to forward the debug instruction message to the second client;
a fourth receiving module 1830, configured to receive the data packet sent by the second client;
a second forwarding module 1840, configured to forward the data packet to the first client, so that a view layer of the first client updates a page display according to the debugging data information.
In one example, as shown in fig. 19, the transit server may further include:
a first connection request obtaining module 1910, configured to obtain a first WebSocket connection request sent by the first client, where the first WebSocket connection request carries an identity of the first client;
a second connection request obtaining module 1920, configured to obtain a second WebSocket connection request sent by the second client, where the second WebSocket connection request carries an identity of the second client;
a determining module 1930, configured to determine whether the identity of the first client matches the identity of the second client;
a transmission channel establishing module 1940, configured to establish a WebSocket transmission channel when the identity of the first client is matched with the identity of the second client.
Referring to fig. 19, in another example, the transit server may further include:
an acknowledgement message sending module 1950, configured to send a first packet acknowledgement message to the second client, so that the second client determines an unreceived packet according to the first packet acknowledgement message, and sends the unreceived packet again.
An acknowledgement message receiving module 1960, configured to receive the second data packet acknowledgement message sent by the first client.
A fourth determining module 1970, configured to determine, according to the second packet acknowledgement message, a packet that is not received by the first client.
In this example, the fourth receiving module 1830 may also be configured to receive an unreceived data packet sent by the second client.
In this example, the second forwarding module 1840 may be further configured to resend the data packet that is not received by the first client to the first client.
An embodiment of the present invention further provides a remote debugging system for an applet, where the system at least includes a first client, a transit server, and a second client, where a view layer is deployed in the first client, and a logic layer is deployed in the second client;
the first client is used for responding to a trigger event and generating a debugging instruction message, wherein the debugging instruction message carries information of data to be debugged; sending the debugging instruction message to a transfer server; receiving and analyzing the data packet forwarded by the transit server to obtain the debugging data information; transferring the debugging data information to the view layer so that the view layer updates page display according to the debugging data information;
the transit server is used for receiving the debugging instruction message sent by the first client; forwarding the debugging instruction message to the second client; receiving a data packet sent by the second client; forwarding the data packet to the first client;
the second client is used for receiving the debugging instruction message forwarded by the transit server; transferring the data information to be debugged to the logic layer so that the logic layer debugs according to the data information to be debugged to obtain debugging data information; acquiring the debugging data information from the logic layer and packaging the debugging data information in a data packet; and sending the data packet to a transit server.
It should be noted that, when the client or the relay server provided in the foregoing embodiment implements the functions thereof, the division of the functional modules is merely used as an example, and in practical applications, the functions may be distributed to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the client or the relay server provided by the above embodiments and the method embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments and are not described herein again.
Please refer to fig. 20, which is a schematic structural diagram of a terminal according to an embodiment of the present invention, where the terminal is configured to implement the remote debugging method for the applet on the second client side provided in the foregoing embodiment, or to implement the remote debugging method for the applet on the first client side provided in the foregoing embodiment. Specifically, the method comprises the following steps:
the terminal 2000 may include components such as RF (Radio Frequency) circuitry 2010, memory 2020 including one or more computer-readable storage media, an input unit 2030, a display unit 2040, a video sensor 2050, audio circuitry 2060, a WiFi (wireless fidelity) module 2070, a processor 2080 including one or more processing cores, and a power supply 200. Those skilled in the art will appreciate that the terminal structure shown in fig. 20 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
RF circuit 2010 may be configured to receive and transmit signals during a message transmission or call, and in particular, receive downlink messages from a base station and then send the received downlink messages to one or more processors 2080 for processing; in addition, data relating to uplink is transmitted to the base station. In general, RF circuitry 2010 includes, but is not limited to, an antenna, at least one Amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like. In addition, RF circuit 2010 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), and the like.
The memory 2020 may be used for storing software programs and modules, and the processor 1480 executes various functional applications and data processing by operating the software programs and modules stored in the memory 2020. The memory 2020 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, and the like), and the like; the storage data area may store data (such as video data, a phone book, etc.) created according to the use of the terminal 2000, and the like. Further, the memory 2020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 2020 may also include a memory controller to provide access to the memory 2020 by the processor 2080 and the input unit 2030.
The input unit 2030 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user setting and function control. Specifically, the input unit 2030 may include an image input device 2031 and other input devices 2032. The image input device 2031 may be a camera or a photoelectric scanning device. The input unit 2030 may include other input devices 2032 in addition to the image input device 2031. In particular, other input devices 2032 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 2040 may be used to display information input by or provided to the user as well as various graphical user interfaces of the terminal 2000, which may be made up of graphics, text, icons, video, and any combination thereof. The Display unit 2040 may include a Display panel 2041, and optionally, the Display panel 2041 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like.
The terminal 2000 may include at least one video sensor 2050 for acquiring video information of a user. Terminal 2000 may also include other sensors (not shown), such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 2041 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 2041 and/or backlight when the terminal 2000 moves to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when the mobile phone is stationary, and can be used for applications of recognizing the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which may be further configured in the terminal 2000, detailed descriptions thereof are omitted.
The video circuitry 2060, speaker 2061, and microphone 2062 may provide a video interface between the user and the terminal 2000. The audio circuit 2060 may transmit the electrical signal converted from the received audio data to the speaker 2061, and convert the electrical signal into a sound signal for output by the speaker 2061; on the other hand, the microphone 2062 converts a collected sound signal into an electric signal, converts the electric signal into audio data after being received by the audio circuit 2060, and outputs the audio data to the processor 2080 for processing, for example, to another terminal via the RF circuit 2011 or outputs the audio data to the memory 2020 for further processing. The audio circuit 2060 may also include an earbud jack to provide communication between a peripheral headset and the terminal 2000.
WiFi belongs to a short-distance wireless transmission technology, and the terminal 2000 can help a user send and receive e-mails, browse webpages, access streaming media, and the like through the WiFi module 2070, and it provides wireless broadband internet access for the user. Although fig. 20 shows the WiFi module 2070, it is understood that it does not belong to the essential constitution of the terminal 2000, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 2080, which is the control center of the terminal 2000, connects various parts of the entire mobile phone using various interfaces and lines, and performs various functions of the terminal 2000 and processes data by operating or executing software programs and/or modules stored in the memory 2020 and calling data stored in the memory 2020, thereby integrally monitoring the mobile phone. Optionally, the processor 2080 may include one or more processing cores; preferably, the processor 2080 may integrate an application processor, which handles primarily the operating system, user interface, and applications, etc., and a modem processor, which handles primarily wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 2080.
The terminal 2000 further includes a power supply 200 (e.g., a battery) for supplying power to various components, which may preferably be logically connected to the processor 2080 via a power management system, so as to manage charging, discharging, and power consumption via the power management system. The power supply 200 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown, the terminal 2000 may further include a bluetooth module or the like, which is not described in detail herein.
In this embodiment, the terminal 2000 further comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors. The one or more programs include instructions for performing the remote debugging method of the applet provided by the above-described method embodiments.
Embodiments of the present invention also provide a storage medium, which may be disposed in a terminal to store at least one instruction, at least one program, a set of codes, or a set of instructions related to a method for implementing remote debugging of an applet at a first client side or a second client side in the method embodiments, where the at least one instruction, the at least one program, the set of codes, or the set of instructions is loaded and executed by the processor to implement the method for remote debugging of an applet provided in the method embodiments.
Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
An embodiment of the present invention further provides a storage medium, where the storage medium may be disposed in a server to store at least one instruction, at least one program, a set of codes, or a set of instructions related to a method for implementing remote debugging of an applet on a relay server side in the method embodiment, and the at least one instruction, the at least one program, the set of codes, or the set of instructions are loaded and executed by the processor to implement the method for implementing remote debugging of an applet provided in the method embodiment.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (15)

1. A remote debugging method of an applet is applied to a remote debugging system of the applet, the system at least comprises a first client, a transit server and a second client, wherein the first client is an application program installed in an operating system of a mobile terminal, a view layer of the applet is deployed in the first client, a logic layer of the applet is deployed in the second client, and for the second client, the method comprises the following steps:
receiving a debugging instruction message forwarded by the transfer server, wherein the debugging instruction message carries information of data to be debugged; the debugging instruction message is generated by the first client end in response to a trigger event and is sent to the transfer server by the first client end;
transferring the data information to be debugged to a logic layer of the small program so that the logic layer of the small program performs logic adjustment according to the data information to be debugged and runs the adjusted logic to obtain debugging data information;
acquiring the debugging data information from the logic layer of the applet, and packaging the debugging data information in a data packet;
and sending the data packet to a transfer server so that the transfer server forwards the data packet to a first client, and updating page display of the view layer of the applet in the first client according to the debugging data information.
2. The applet remote debugging method according to claim 1, wherein said encapsulating said debugging data information in a data packet comprises:
setting corresponding serial numbers for the debugging data information according to the order of obtaining the debugging data information;
generating a first time interval corresponding to the debugging data information according to the debugging data information and the obtaining time interval of the debugging data information of the adjacent serial numbers;
and encapsulating the debugging data information, the sequence number corresponding to the debugging data information and the first time interval in a data packet.
3. The applet remote debugging method according to claim 1, wherein the debugging instruction message further includes a first category tag for indicating a category of the data information to be debugged, the category of the data information to be debugged at least including updating the view layer;
the transferring the data information to be debugged to the logic layer comprises:
acquiring the first category label;
determining the category of the data information to be debugged according to the first category label;
and when the type of the data information to be debugged is to update the view layer, transferring the data information to be debugged to the logic layer.
4. The applet remote debugging method according to claim 1,
the debugging data information comprises a second category label used for indicating the category of the debugging data information, and the category of the debugging data information at least comprises updating the view layer.
5. A remote debugging method of an applet is applied to a remote debugging system of the applet, the system at least comprises a first client, a transit server and a second client, wherein the first client is an application program installed in an operating system of a mobile terminal, a view layer of the applet is deployed in the first client, a logic layer of the applet is deployed in the second client, and for the first client, the method comprises the following steps:
responding to a trigger event, and generating a debugging instruction message, wherein the debugging instruction message carries information of data to be debugged;
sending the debugging instruction message to a transfer server so that the transfer server forwards the debugging instruction message to a second client, wherein the second client is used for receiving the debugging instruction message and transferring the debugging instruction message to a logic layer of the applet so that the logic layer of the applet carries out logic adjustment according to the data information to be debugged and runs the adjusted logic to obtain debugging data information; acquiring the debugging data information from the logic layer of the applet, and packaging the debugging data information in a data packet; sending the data packet to a transit server so that the transit server forwards the data packet;
receiving and analyzing the data packet forwarded by the transit server to obtain the debugging data information;
and transferring the debugging data information to a view layer of the applet so that the view layer updates page display according to the debugging data information.
6. The applet remote debugging method according to claim 5, characterized in that the data packet further comprises a sequence number and a first time interval corresponding to the debugging data information;
before transferring the debug data information to the view layer, the method further comprises:
acquiring a serial number and a first time interval corresponding to the debugging data information;
sequencing the debugging data information according to the serial number;
acquiring a second time interval between the time of executing the last debugging data information and the current time;
and determining to execute the debugging data information according to the first time interval and the second time interval.
7. The applet remote debugging method according to claim 5, wherein the debugging data information includes a second category tag indicating a category of the debugging data information, the category of the debugging data information including at least updating the view layer;
the transferring the debugging data information to the view layer includes:
acquiring the second category label;
determining the category of the debugging data information according to the second category label;
and when the type of the debugging data information is the updating of the view layer, transferring the debugging data information to the view layer.
8. The applet remote debugging method according to claim 5, characterized in that said generating a debugging instruction message in response to a triggering event comprises:
acquiring the category of the data information to be debugged according to the trigger event;
generating a first class label for indicating the class of the data information to be debugged according to the class of the data information to be debugged;
generating the debugging instruction message according to the data information to be debugged and the first class label;
and updating the view layer according to the category of the data information to be debugged.
9. A remote debugging method of an applet is applied to a remote debugging system of the applet, the system at least comprises a first client, a transit server and a second client, wherein the first client is an application program installed in an operating system of a mobile terminal, a view layer of the applet is deployed in the first client, a logic layer of the applet is deployed in the second client, and for the transit server, the method comprises the following steps:
receiving a debugging instruction message sent by the first client, wherein the debugging instruction message carries information of data to be debugged; the first client is used for responding to a trigger event, generating a debugging instruction message and sending the debugging instruction message;
forwarding the debugging instruction message to the second client; the second client is used for receiving the debugging instruction message; transferring the data information to be debugged to a logic layer of the small program so that the logic layer of the small program performs logic adjustment according to the data information to be debugged and runs the adjusted logic to obtain debugging data information; acquiring the debugging data information from a logic layer of the applet, packaging the debugging data information in a data packet and sending the data packet;
receiving a data packet sent by the second client;
and forwarding the data packet to the first client side so that a view layer of the applet in the first client side updates page display according to the debugging data information.
10. The applet remote debugging method according to claim 9, characterized in that before receiving the debugging instruction message sent by the first client, the method further comprises:
acquiring a first WebSocket connection request sent by the first client, wherein the first WebSocket connection request carries an identity of the first client;
acquiring a second WebSocket connection request sent by a second client, wherein the second WebSocket connection request carries an identity of the second client;
judging whether the identity of the first client is matched with the identity of the second client;
and when the identity of the first client is matched with the identity of the second client, establishing a WebSocket transmission channel.
11. The applet remote debugging method according to claim 9, characterized in that after receiving the data packets sent by the second client and before forwarding the data packets to the first client, the method further comprises:
sending a first data packet confirmation message to the second client, so that the second client determines the data packet which is not received according to the first data packet confirmation message, and sending the data packet which is not received again;
receiving an unreceived data packet sent by the second client;
after forwarding the data packet to the first client, the method further comprises:
receiving a second data packet confirmation message sent by the first client;
determining a data packet which is not received by the first client according to the second data packet confirmation message;
and sending the data packet which is not received by the first client to the first client again.
12. A second client, where a logic layer of an applet is deployed in the second client, the second client is applied to a remote debugging system of the applet, the remote debugging system of the applet at least further includes a transit server and a first client, the first client is an application installed in an operating system of a mobile terminal, a view layer of the applet is deployed in the first client, and the second client includes:
the first receiving module is used for receiving the debugging instruction message forwarded by the transfer server, wherein the debugging instruction message carries the information of data to be debugged; the debugging instruction message is generated by the first client end in response to a trigger event and is sent to the transfer server by the first client end;
the first transfer module is used for transferring the data information to be debugged to a logic layer of the small program, so that the logic layer of the small program performs logic adjustment according to the data information to be debugged and runs the adjusted logic to obtain debugging data information;
the encapsulation module is used for acquiring the debugging data information from the logic layer of the applet and encapsulating the debugging data information in a data packet;
and the first sending module is used for sending the data packet to a transfer server so that the transfer server forwards the data packet to a first client, and the view layer of the applet in the first client updates page display according to the debugging data information.
13. A first client is characterized in that the first client is an application program installed in an operating system of a mobile terminal, a view layer of an applet is deployed in the first client, the first client is applied to a remote debugging system of the applet, the remote debugging system of the applet at least further comprises a transit server and a second client, a logic layer of the applet is deployed in the second client, and the first client comprises:
the first generation module is used for responding to a trigger event and generating a debugging instruction message, wherein the debugging instruction message carries data information to be debugged;
a second sending module, configured to send the debug instruction message to a transit server, so that the transit server forwards the debug instruction message to a second client, where the second client is configured to receive the debug instruction message, and transfer the debug instruction message to a logic layer of the applet, so that the logic layer of the applet performs logic adjustment according to the to-be-debugged data information and runs the adjusted logic to obtain debug data information; acquiring the debugging data information from the logic layer of the applet, and packaging the debugging data information in a data packet; sending the data packet to a transit server so that the transit server forwards the data packet;
the second receiving module is used for receiving and analyzing the data packet forwarded by the transit server to obtain the debugging data information;
and the second transfer module is used for transferring the debugging data information to a view layer of the applet so that the view layer updates page display according to the debugging data information.
14. The transfer server is applied to a remote debugging system of an applet, the remote debugging system of the applet at least further comprises a first client and a second client, the first client is an application program installed in an operating system of a mobile terminal, a view layer of the applet is deployed in the first client, a logic layer of the applet is deployed in the second client, and the transfer server comprises:
the third receiving module is used for receiving a debugging instruction message sent by the first client, wherein the debugging instruction message carries information of data to be debugged; the first client is used for responding to a trigger event, generating a debugging instruction message and sending the debugging instruction message;
the first forwarding module is used for forwarding the debugging instruction message to the second client; the second client is used for receiving the debugging instruction message; transferring the data information to be debugged to a logic layer of the small program so that the logic layer of the small program performs logic adjustment according to the data information to be debugged and runs the adjusted logic to obtain debugging data information; acquiring the debugging data information from a logic layer of the applet, packaging the debugging data information in a data packet and sending the data packet;
a fourth receiving module, configured to receive the data packet sent by the second client;
and the second forwarding module is used for forwarding the data packet to the first client so as to update the page display of the view layer of the applet in the first client according to the debugging data information.
15. The remote debugging system of the applet is characterized by at least comprising a first client, a transfer server and a second client, wherein the first client is an application program installed in an operating system of a mobile terminal, a view layer of the applet is deployed in the first client, and a logic layer of the applet is deployed in the second client;
the first client is used for responding to a trigger event and generating a debugging instruction message, wherein the debugging instruction message carries information of data to be debugged; sending the debugging instruction message to a transfer server; receiving and analyzing the data packet forwarded by the transit server to obtain the debugging data information; transferring the debugging data information to a view layer of the applet so that the view layer updates page display according to the debugging data information;
the transit server is used for receiving the debugging instruction message sent by the first client; forwarding the debugging instruction message to the second client; receiving a data packet sent by the second client; forwarding the data packet to the first client;
the second client is used for receiving the debugging instruction message forwarded by the transit server; transferring the data information to be debugged to a logic layer of the small program so that the logic layer of the small program performs logic adjustment according to the data information to be debugged and runs the adjusted logic to obtain debugging data information; acquiring the debugging data information from the logic layer of the applet, and packaging the debugging data information in a data packet; and sending the data packet to a transit server.
CN201810642255.6A 2018-06-21 2018-06-21 Remote debugging method, related equipment and system for small program Active CN109117361B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810642255.6A CN109117361B (en) 2018-06-21 2018-06-21 Remote debugging method, related equipment and system for small program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810642255.6A CN109117361B (en) 2018-06-21 2018-06-21 Remote debugging method, related equipment and system for small program

Publications (2)

Publication Number Publication Date
CN109117361A CN109117361A (en) 2019-01-01
CN109117361B true CN109117361B (en) 2020-12-15

Family

ID=64822470

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810642255.6A Active CN109117361B (en) 2018-06-21 2018-06-21 Remote debugging method, related equipment and system for small program

Country Status (1)

Country Link
CN (1) CN109117361B (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109800101A (en) * 2019-02-01 2019-05-24 北京字节跳动网络技术有限公司 Report method, device, terminal device and the storage medium of small routine abnormal conditions
CN110032512B (en) * 2019-03-28 2021-04-20 腾讯科技(深圳)有限公司 Debugging method of small program, related equipment and terminal
CN110138833B (en) * 2019-04-12 2023-05-30 中国平安人寿保险股份有限公司 Rapid adjustment method, device, medium and equipment for real Native module in APP
CN110083466B (en) * 2019-04-28 2021-07-06 百度在线网络技术(北京)有限公司 Data transmission method and device for small program
CN110290055B (en) * 2019-06-25 2021-09-10 携程计算机技术(上海)有限公司 Method and system for communication between WeChat applet WebView and native component
CN110837473B (en) * 2019-11-07 2023-08-22 腾讯科技(深圳)有限公司 Application program debugging method, device, terminal and storage medium
CN110908904A (en) * 2019-11-15 2020-03-24 北京小米移动软件有限公司 Method and device for debugging fast application and electronic equipment
CN111078530A (en) * 2019-11-22 2020-04-28 北京奇艺世纪科技有限公司 Application program debugging method and system, electronic equipment and computer readable storage medium
CN111078554B (en) * 2019-12-16 2022-05-27 腾讯科技(深圳)有限公司 Applet debugging method, device, equipment and storage medium
CN111258887A (en) * 2020-01-09 2020-06-09 支付宝(杭州)信息技术有限公司 Debugging method and device for scripting language application and terminal
CN111866083A (en) * 2020-06-23 2020-10-30 北京三快在线科技有限公司 Equipment debugging system and method, equipment to be debugged, remote debugging equipment and transfer server
CN111970364A (en) * 2020-08-17 2020-11-20 创新奇智(重庆)科技有限公司 Hardware debugging execution method and device, electronic equipment and storage medium
CN112187869A (en) * 2020-09-03 2021-01-05 京东数字科技控股股份有限公司 Remote debugging system and method of IOT device, electronic device and storage medium
CN113608997A (en) * 2021-06-30 2021-11-05 北京新氧科技有限公司 Remote debugging method and device for embedded webpage of application program and electronic equipment
CN113760762B (en) * 2021-09-08 2024-03-08 贝壳找房(北京)科技有限公司 Method for simulating operating environment of applet, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902618A (en) * 2011-07-28 2013-01-30 华为技术有限公司 Method and device for developing and debugging application programs of mobile equipment
CN103268288A (en) * 2013-06-18 2013-08-28 北京云测信息技术有限公司 Remote real machine debugging method and system of mobile terminal application software
CN103902358A (en) * 2014-03-18 2014-07-02 北京领通科技有限公司 Mobile terminal remote debugging method and system and mobile terminal
CN104991857A (en) * 2015-06-08 2015-10-21 小米科技有限责任公司 Method and apparatus for trace debugging
CN107728999A (en) * 2017-11-14 2018-02-23 苏州奇松软件有限公司 A kind of App, the method and system of small routine interface simulation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902618A (en) * 2011-07-28 2013-01-30 华为技术有限公司 Method and device for developing and debugging application programs of mobile equipment
CN103268288A (en) * 2013-06-18 2013-08-28 北京云测信息技术有限公司 Remote real machine debugging method and system of mobile terminal application software
CN103902358A (en) * 2014-03-18 2014-07-02 北京领通科技有限公司 Mobile terminal remote debugging method and system and mobile terminal
CN104991857A (en) * 2015-06-08 2015-10-21 小米科技有限责任公司 Method and apparatus for trace debugging
CN107728999A (en) * 2017-11-14 2018-02-23 苏州奇松软件有限公司 A kind of App, the method and system of small routine interface simulation

Also Published As

Publication number Publication date
CN109117361A (en) 2019-01-01

Similar Documents

Publication Publication Date Title
CN109117361B (en) Remote debugging method, related equipment and system for small program
CN110032512B (en) Debugging method of small program, related equipment and terminal
CN107102904B (en) Interaction method and device based on hybrid application program
CN111176961B (en) Application program testing method and device and storage medium
CN109088844B (en) Information interception method, terminal, server and system
CN108509299B (en) Message processing method, device and computer readable storage medium
CN107329901B (en) Data packet capturing method, terminal, server and storage medium
CN109857403B (en) Page updating method and device, page processing method and device
WO2018077041A1 (en) Method and apparatus for running application
CN110391867B (en) DCI detection method, DCI sending method, terminal and base station
CN112148579B (en) User interface testing method and device
CN106293738B (en) Expression image updating method and device
WO2014198116A1 (en) Method, apparatus and system for short message-based information push and mobile client supporting the same
CN108600516B (en) Data acquisition method, mobile terminal and computer readable storage medium
CN112087362B (en) Message forwarding method and device between clients and terminal
CN106953898B (en) Method and device for acquiring software package
CN104239332A (en) Webpage content processing method, webpage content processing device and browser client side
CN105871425B (en) The method and apparatus that first equipment receives synchronization message from the second equipment
CN108009031B (en) Application program control method and mobile terminal
CN109495769B (en) Video communication method, terminal, smart television, server and storage medium
CN115174418A (en) Communication environment safety early warning method and device, electronic equipment and storage medium
CN109688611B (en) Frequency band parameter configuration method, device, terminal and storage medium
CN107317828B (en) File downloading method and device
CN111273955A (en) Thermal restoration plug-in optimization method and device, storage medium and electronic equipment
CN104391629A (en) Method for sending message in orientation manner, method for displaying message, server and terminal

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
GR01 Patent grant
GR01 Patent grant