CN111010447A - Data communication method and device - Google Patents

Data communication method and device Download PDF

Info

Publication number
CN111010447A
CN111010447A CN201911338113.1A CN201911338113A CN111010447A CN 111010447 A CN111010447 A CN 111010447A CN 201911338113 A CN201911338113 A CN 201911338113A CN 111010447 A CN111010447 A CN 111010447A
Authority
CN
China
Prior art keywords
webview
request message
communication identifier
communication
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911338113.1A
Other languages
Chinese (zh)
Inventor
熊峰
淡云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201911338113.1A priority Critical patent/CN111010447A/en
Publication of CN111010447A publication Critical patent/CN111010447A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a data communication method and a data communication device. When receiving a first request message sent by the Webview control, the Webview container may send a first response message carrying a first communication identifier to the Webview control according to the first request message. When receiving a first response packet sent by the Webview container, the Webview control may determine a processing result of the first request packet, and based on the processing, the Webview control may determine a processing result including a time at which the first request packet is sent and a time at which the first response packet is received.

Description

Data communication method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data communication method and apparatus.
Background
The Webview control is embedded inside the client, and can be used for showing the control of the webpage based on webkit (an open source browser engine). In practical applications, the Webview control can obtain data from a Webview container (a part of the client other than the Webview control can be referred to as the Webview container). For example, when an operation instruction for accessing a certain web page is received, the Webview control may acquire data included in the web page from the Webview container, and then the Webview control may display the web page in the user interface of the client according to the acquired data included in the web page.
In the prior art, the process of acquiring data from the Webview container by the Webview control may include the following steps: the Webview control sends a request message aiming at data (which can be called as target data) to be acquired to the Webview container, the Webview container can process the received request message, then a response message carrying the target data is sent to the Webview control through a global callback function of the Webview control, and further the Webview control can analyze and process the received response message to acquire the target data carried in the response message.
However, when the Webview control sends multiple request messages to the Webview container, the Webview container may correspondingly return multiple response messages to the Webview control, and after the Webview control receives each response message, the request message corresponding to each response message cannot be determined, and thus, the processing result of the Webview container for each request message cannot be determined.
Disclosure of Invention
An object of the embodiments of the present invention is to provide a data communication method and apparatus, which can determine a processing result of a request packet. The specific technical scheme is as follows:
in a first aspect of the present invention, a data communication method is provided, where the method is applied to a web browsing Webview control in a client, and the method includes:
sending a first request message carrying a first communication identifier to a Webview container in the client, wherein the first communication identifier is used for representing the uniqueness of the first request message;
and when a first response message which is sent by the Webview container according to the first request message and carries the first communication identifier is received, determining a processing result of the first request message, wherein the processing result comprises the time of sending the first request message and the time of receiving the first response message.
Optionally, before the sending the first request packet carrying the first communication identifier to the Webview container in the client, the method further includes:
and generating the first communication identifier based on the moment of sending the first request message, the browser fingerprint of the Webview control and the random character string.
Optionally, after the sending the first request packet carrying the first communication identifier to the Webview container in the client, the method further includes:
storing the first communication identifier in an unresponsive queue, wherein the unresponsive queue is used for recording the communication identifier of the request message of which the corresponding response message is not received;
when the preset detection time is reached, aiming at each communication identifier recorded in the unresponsive queue, calculating the time length between the time of sending the request message corresponding to the communication identifier and the current time;
and if the calculated time length is longer than the preset time length, marking the overtime processing of the request message corresponding to the communication identification.
Optionally, the method further includes:
storing a callback function corresponding to the first request message in the unresponsive queue, wherein the callback function corresponding to the first request message is used for processing the first response message corresponding to the first request message;
when the first response message is received, judging whether the first request message is marked as processing overtime;
and if the first request message is not marked as processing overtime, analyzing and processing the first response message according to a callback function corresponding to the first request message.
Optionally, after the calculating a duration between the time of sending the request packet corresponding to the communication identifier and the current time, the method further includes:
and if the calculated time length is longer than the preset time length, displaying a prompt message of the overtime processing of the request message corresponding to the communication identification in a user interface of the client.
In a second aspect implemented by the present invention, there is provided a data communication method applied to a web browsing Webview container in a client, the method including:
receiving a first request message which is sent by a Webview control in the client and carries a first communication identifier, wherein the first communication identifier is used for representing the uniqueness of the first request message;
and sending a first response message carrying the first communication identifier to the Webview control so that the Webview control determines a processing result of the first request message according to the first response message, wherein the processing result comprises the time when the Webview control sends the first request message and the time when the Webview control receives the first response message.
In a third aspect of the present invention, there is also provided a data communication apparatus, where the apparatus is applied to a Webview control in a client, and the apparatus includes:
a sending module, configured to send a first request packet carrying a first communication identifier to a Webview container in the client, where the first communication identifier is used to indicate uniqueness of the first request packet;
and the determining module is used for determining a processing result of the first request message when receiving a first response message which is sent by the Webview container according to the first request message and carries the first communication identifier, wherein the processing result comprises the time of sending the first request message and the time of receiving the first response message.
Optionally, the apparatus further comprises:
and the generating module is used for generating the first communication identifier based on the moment of sending the first request message, the browser fingerprint of the Webview control and the random character string.
Optionally, the apparatus further comprises:
the processing module is used for storing the first communication identifier in an unresponsive queue, wherein the unresponsive queue is used for recording the communication identifier of the request message of the corresponding response message which is not received;
when the preset detection time is reached, aiming at each communication identifier recorded in the unresponsive queue, calculating the time length between the time of sending the request message corresponding to the communication identifier and the current time;
and if the calculated time length is longer than the preset time length, marking the overtime processing of the request message corresponding to the communication identification.
Optionally, the processing module is further configured to store a callback function corresponding to the first request packet in the unresponsive queue, where the callback function corresponding to the first request packet is used to process the first response packet corresponding to the first request packet;
when the first response message is received, judging whether the first request message is marked as processing overtime;
and if the first request message is not marked as processing overtime, analyzing and processing the first response message according to a callback function corresponding to the first request message.
Optionally, the processing module is further configured to display a prompt message that the request message corresponding to the communication identifier is overtime in the user interface of the client if the calculated duration is greater than a preset duration.
In a fourth aspect implemented by the present invention, there is also provided a data communication apparatus applied to a Webview container in a client, the apparatus including:
a receiving module, configured to receive a first request packet that is sent by a Webview control in the client and carries a first communication identifier, where the first communication identifier is used to indicate uniqueness of the first request packet;
and the sending module is used for sending a first response message carrying the first communication identifier to the Webview control so that the Webview control determines a processing result of the first request message according to the first response message, wherein the processing result comprises the time when the Webview control sends the first request message and the time when the Webview control receives the first response message.
In another aspect of the implementation of the present invention, an embodiment of the present invention further provides an electronic device, which includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor, configured to implement the steps of the data communication method according to the first aspect when executing the program stored in the memory.
In another aspect of the implementation of the present invention, an embodiment of the present invention further provides an electronic device, which includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor, configured to implement the steps of the data communication method according to the second aspect when executing the program stored in the memory.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the data communication method of the first aspect described above.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the data communication method of the second aspect described above.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the data communication method of the first aspect described above.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the data communication method according to the second aspect described above.
In the data communication method provided by the embodiment of the invention, the Webview control can send the first request message carrying the first communication identifier to the Webview container. The Webview container can send a first response message carrying the first communication identifier to the Webview control according to the received first request message. When receiving a first response packet sent by the Webview container, the Webview control may determine a processing result of the first request packet.
Based on the processing, the request message sent by the Webview control to the Webview container carries the communication identifier, after the Webview container receives the request message, the Webview container can send a response message carrying the same communication identifier to the Webview control according to the communication identifier carried by the request message, and further, after receiving the response message sent by the Webview container, the Webview control can determine the request message carrying the same communication identifier as the response message, wherein the response message is the message of the request message determined by the Webview container in response to the response message. Furthermore, the Webview control can determine a processing result including the time of sending the determined request packet and the time of receiving the response packet.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is an architecture diagram of a client provided in an embodiment of the present invention;
fig. 2 is a flowchart of a data communication method provided in an embodiment of the present invention;
fig. 3 is a flowchart of a data communication method provided in an embodiment of the present invention;
fig. 4 is a flowchart of an example of a data communication method provided in an embodiment of the present invention;
fig. 5 is a block diagram of a data communication apparatus provided in an embodiment of the present invention;
fig. 6 is a block diagram of a data communication apparatus provided in an embodiment of the present invention;
fig. 7 is a block diagram of an electronic device provided in an embodiment of the present invention;
fig. 8 is a structural diagram of an electronic device provided in an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
Referring to fig. 1, fig. 1 is an architecture diagram of a client according to an embodiment of the present invention, where the client includes: webview controls and Webview containers.
The Webview control can send a first request message carrying a first communication identifier to the Webview container. When receiving a first request message sent by the Webview control, the Webview container may send a first response message carrying a first communication identifier to the Webview control according to the first request message. When receiving the first response packet sent by the Webview container, the Webview control may determine a processing result including a time when the first request packet is sent and a time when the first response packet is received.
As can be seen, the request packet sent by the Webview control to the Webview container carries a communication identifier, after the Webview container receives the request packet, the Webview container can send a response packet carrying the same communication identifier to the Webview control according to the communication identifier carried by the request packet, and further, after receiving the response packet sent by the Webview container, the Webview control can determine the request packet carrying the same communication identifier as the response packet, where the response packet is a packet of the request packet determined by the Webview container in response to the response packet. Furthermore, the Webview control can determine a processing result including the time of sending the determined request packet and the time of receiving the response packet.
Referring to fig. 2, fig. 2 is a flowchart of a data communication method provided in an embodiment of the present invention, where the method is applied to a Webview control in a client, and the method may include the following steps:
s201: and sending a first request message carrying a first communication identifier to a Webview container in the client.
The first communication identification is used for representing the uniqueness of the first request message.
When a user needs to access a certain webpage, the user can input an operation instruction for accessing the webpage to the client, and after receiving the operation instruction, the client can acquire data contained in the webpage requested by the operation instruction from the Webview container through the Webview control embedded in the client.
In the embodiment of the invention, when the Webview control needs to acquire data (which may be called target data) from the Webview container, the Webview control may generate a request message for the target data, and then the Webview control may generate a communication identifier (i.e., a first communication identifier) corresponding to the request message, add the communication identifier to the request message to obtain the first request message, and further send the first request message to the Webview container.
In one implementation, after the Webview control sends the first request packet, the Webview control may also record the time when the first request packet is sent locally.
Optionally, before sending the first request packet to the Webview container, the Webview control may further generate the first communication identifier based on the time at which the first request packet is generated, the browser fingerprint of the Webview control, and the random character string. Because the time interval between the time of generating the first request message and the time of sending the first request message is short, the time of generating the first request message and the time of sending the first request message can be equal to the same time.
In one implementation, the Webview control may encode the time of sending the first request packet, the browser fingerprint of the Webview control, and the random character string based on a hash algorithm, and a hash value obtained by encoding is the first communication identifier.
Correspondingly, after receiving a first request message sent by the Webview control, the Webview container may extract a first communication identifier carried in the first request message, add the first communication identifier to a response message carrying target data to obtain a first response message, and then send the first response message to the Webview control through a global callback function of the Webview control.
S202: and when a first response message which is sent by the Webview container according to the first request message and carries the first communication identifier is received, determining a processing result of the first request message.
The processing result of the first request packet may include a time when the Webview control sends the first request packet and a time when the Webview control receives the first response packet.
When receiving a response message sent by the Webview container, the Webview control can determine a request message carrying the same communication identifier as the response message, the determined request message is the request message corresponding to the response message, and then the Webview control can determine a processing result including the time of sending the determined request message and the time of receiving the response message.
Based on the processing, the request message sent by the Webview control to the Webview container carries the communication identifier, after the Webview container receives the request message, the Webview container can send a response message carrying the same communication identifier to the Webview control according to the communication identifier carried by the request message, and further, after receiving the response message sent by the Webview container, the Webview control can determine the request message carrying the same communication identifier as the response message, wherein the response message is the message of the request message determined by the Webview container in response to the response message. Furthermore, the Webview control can determine a processing result including the time of sending the determined request packet and the time of receiving the response packet.
Optionally, after the Webview control sends each request packet to the Webview container, it may also detect whether each request packet is overtime.
Accordingly, after step S201, the method may further include the steps of:
step one, storing the first communication identification in an unresponsive queue.
The non-response queue is used for recording the communication identifiers of the request messages of which the corresponding response messages are not received.
And step two, when the preset detection time is reached, aiming at each communication identifier recorded in the unresponsive queue, calculating the time length between the time of sending the request message corresponding to the communication identifier and the current time.
In one implementation manner, for each communication identifier recorded in the unresponsive queue, the Webview control may set a timer corresponding to the communication identifier, and when a preset detection time corresponding to the communication identifier is reached, the Webview control may calculate a time length between a time at which the request packet corresponding to the communication identifier is sent and a current time.
Illustratively, if a communication identifier 1 and a communication identifier 2 are stored in the unresponsive queue, the Webview control may set that the communication identifier 1 corresponds to a timer (may be referred to as timer 1), the communication identifier 2 corresponds to a timer (may be referred to as timer 2), and when a preset detection time corresponding to the timer 1 is reached, the Webview control may calculate a time length between a time of sending a request packet corresponding to the communication identifier 1 and a current time; when the preset detection time corresponding to the timer 2 is reached, the Webview control can calculate the time length between the time of sending the request message corresponding to the communication identifier 2 and the current time.
In another implementation manner, in order to save computing resources, for each communication identifier recorded in the unresponsive queue, the Webview control may set a timer corresponding to each communication identifier, and when a preset detection time corresponding to the timer is reached, for each communication identifier recorded in the unresponsive queue, the Webview control may calculate a time length between a time at which the request packet corresponding to the communication identifier is sent and a current time.
Illustratively, if the communication identifier 1 and the communication identifier 2 are stored in the unresponsive queue, the Webview control may set each communication identifier (i.e., the communication identifier 1 and the communication identifier 2) recorded in the unresponsive queue to correspond to one timer, and when a preset detection time corresponding to the timer is reached, the Webview control may respectively calculate a time length between a time of sending the request packet corresponding to the communication identifier 1 and the current time, and a time length between a time of sending the request packet corresponding to the communication identifier 2 and the current time.
And step three, if the calculated time length is greater than the preset time length, marking the overtime processing of the request message corresponding to the communication identification.
Wherein the preset duration can be set by a technician according to experience.
In one implementation, for a communication identifier stored in an unresponsive queue, after calculating a time length between a time of sending a request packet corresponding to the communication identifier and a current time, a Webview control may determine whether the calculated time length is greater than a preset time length, and if the calculated time length is greater than the preset time length, the Webview control may determine that processing of the request packet corresponding to the communication identifier is overtime, for example, the Webview control may mark processing of the request packet corresponding to the communication identifier in a global callback function as overtime.
In addition, if the Webview control determines that the processing of the request message corresponding to a certain communication identifier is overtime, the Webview control can also display a prompt message of the overtime processing of the request message corresponding to the communication identifier in a user interface of the client.
Optionally, a callback function corresponding to the first request packet may also be stored in the unresponsive queue, and the method may further include the following steps:
step 1, storing a callback function corresponding to the first request message in an unresponsive queue.
The callback function corresponding to the first request message is used for processing a first response message corresponding to the first request message.
And step 2, judging whether the first request message is marked as processing overtime or not when the first response message is received.
In one implementation, after receiving the first response packet, the Webview control may determine that a request packet (i.e., the first request packet) carrying the first communication identifier is a request packet corresponding to the first response packet, and then the Webview control may determine whether the first request packet is marked as processing timeout, and perform corresponding processing according to a determination result.
And 3, if the first request message is not marked as processing overtime, analyzing and processing the first response message according to a callback function corresponding to the first request message.
In one implementation, after receiving the first response packet, if the first request packet is not marked as processing timeout, the Webview control may extract target data carried in the first response packet through a callback function corresponding to the first request packet.
In addition, after the Webview control analyzes and processes the first response packet according to the callback function corresponding to the first request packet, the Webview control may also delete the first communication identifier and the callback function corresponding to the first request packet from the unresponsive queue.
Optionally, if the Webview control determines that the processing of the request packet corresponding to a communication identifier is overtime, the Webview control may also remove the communication identifier from the unresponsive queue, and store the communication identifier in a new queue (which may be referred to as a overtime queue). The overtime queue is used for recording the communication identifier corresponding to the request message marked as processing overtime.
After receiving a response message sent by the Webview container, if the communication identifier corresponding to the response message is stored in the overtime queue, the Webview control can determine that the request message corresponding to the response message is marked as processing overtime, and the Webview control can not analyze and process the response message.
In an implementation manner, an empty callback function (the empty callback function indicates that no parsing processing is performed on a received response packet) may also be stored in the overtime queue, after a response packet sent by a Webview container is received, if a communication identifier corresponding to the response packet is stored in the overtime queue, it indicates that a request packet corresponding to the response packet is marked as processing overtime, and the Webview control may call the empty callback function stored in the overtime queue, not perform parsing processing on the response packet, and delete the communication identifier corresponding to the response packet from the overtime queue.
In addition, after receiving the response message sent by the Webview container, the Webview control can also generate a processing log of the request message corresponding to the response message.
If the request message corresponding to the response message is not marked as processing overtime, the Webview control can generate a processing log which records the time of sending the request message corresponding to the response message and the time of receiving the response message.
If the request message corresponding to the response message is marked as processing overtime, the Webview control can generate a processing log which records the time of sending the request message corresponding to the response message, the time of receiving the response message and the overtime mark of the processing overtime of the request message corresponding to the response message.
Referring to fig. 3, fig. 3 is a flowchart of a data communication method provided in an embodiment of the present invention, where the method is applied to a Webview container in a client, and the method includes the following steps:
s301: and receiving a first request message which is sent by a Webview control in a client and carries a first communication identifier.
The first communication identification is used for representing the uniqueness of the first request message.
When the Webview control needs to acquire data (i.e., target data) from the Webview container, the Webview control can generate a request packet for the target data. Then, the Webview control may generate a communication identifier (i.e., a first communication identifier) corresponding to the request packet, add the communication identifier to the request packet to obtain a first request packet, and send the first request packet to the Webview container.
S302: and sending a first response message carrying the first communication identifier to the Webview control so that the Webview control determines the processing result of the first request message according to the first response message.
The processing result of the first request message comprises the time when the Webview control sends the first request message and the time when the first response message is received.
After receiving a first request message sent by the Webview control, the Webview container can extract a first communication identifier carried in the first request message, then add the first communication identifier to a response message carrying target data to obtain a first response message, and further, the Webview container can send the first response message to the Webview control through a global callback function of the Webview control.
Accordingly, after receiving the first response packet, the Webview control may determine a processing result of the first request packet, and the Webview control determines a method for determining the processing result of the first request packet.
Based on the processing, the request message sent by the Webview control to the Webview container carries the communication identifier, after the Webview container receives the request message, the Webview container can send a response message carrying the same communication identifier to the Webview control according to the communication identifier carried by the request message, and further, after receiving the response message sent by the Webview container, the Webview control can determine the request message carrying the same communication identifier as the response message, wherein the response message is the message of the request message determined by the Webview container in response to the response message. Furthermore, the Webview control can determine a processing result including the time of sending the determined request packet and the time of receiving the response packet.
Referring to fig. 4, fig. 4 is a flowchart of an example of a data communication method according to an embodiment of the present invention, including the following steps:
s401: and the Webview control sends a first request message carrying the first communication identifier to the Webview container.
The first communication identification is used for representing the uniqueness of the first request message. The first communication identifier may be generated based on a time at which the first request packet is sent, a browser fingerprint of the Webview control, and a random string.
S402: and the Webview container sends a first response message carrying the first communication identifier to the Webview control according to the first request message.
S403: and when receiving a first response message sent by the Webview container, the Webview control determines the processing result of the first request message according to the first response message.
The processing result of the first request message comprises the time when the Webview control sends the first request message and the time when the first response message is received.
Corresponding to the embodiment of the method in fig. 2, referring to fig. 5, fig. 5 is a structural diagram of a data communication device provided in an embodiment of the present invention, where the device is applied to a Webview control in a client, and the device includes:
a sending module 501, configured to send a first request packet carrying a first communication identifier to a Webview container in the client, where the first communication identifier is used to indicate uniqueness of the first request packet;
a determining module 502, configured to determine a processing result of the first request packet when receiving a first response packet, which is sent by the Webview container according to the first request packet and carries the first communication identifier, where the processing result includes a time when the first request packet is sent and a time when the first response packet is received.
Optionally, the apparatus further comprises:
and the generating module is used for generating the first communication identifier based on the moment of sending the first request message, the browser fingerprint of the Webview control and the random character string.
Optionally, the apparatus further comprises:
the processing module is used for storing the first communication identifier in an unresponsive queue, wherein the unresponsive queue is used for recording the communication identifier of the request message of the corresponding response message which is not received;
when the preset detection time is reached, aiming at each communication identifier recorded in the unresponsive queue, calculating the time length between the time of sending the request message corresponding to the communication identifier and the current time;
and if the calculated time length is longer than the preset time length, marking the overtime processing of the request message corresponding to the communication identification.
Optionally, the processing module is further configured to store a callback function corresponding to the first request packet in the unresponsive queue, where the callback function corresponding to the first request packet is used to process the first response packet corresponding to the first request packet;
when the first response message is received, judging whether the first request message is marked as processing overtime;
and if the first request message is not marked as processing overtime, analyzing and processing the first response message according to a callback function corresponding to the first request message.
Optionally, the processing module is further configured to display a prompt message that the request message corresponding to the communication identifier is overtime in the user interface of the client if the calculated duration is greater than a preset duration.
Corresponding to the embodiment of the method in fig. 3, referring to fig. 6, fig. 6 is a block diagram of a data communication device, which is applied to a Webview container in a client, according to an embodiment of the present invention, where the device includes:
a receiving module 601, configured to receive a first request packet that is sent by a Webview control in the client and carries a first communication identifier, where the first communication identifier is used to indicate uniqueness of the first request packet;
a sending module 602, configured to send a first response packet carrying the first communication identifier to the Webview control, so that the Webview control determines a processing result of the first request packet according to the first response packet, where the processing result includes a time when the Webview control sends the first request packet and a time when the Webview control receives the first response packet.
Based on the processing, the request message sent by the Webview control to the Webview container carries the communication identifier, after the Webview container receives the request message, the Webview container can send a response message carrying the same communication identifier to the Webview control according to the communication identifier carried by the request message, and further, after receiving the response message sent by the Webview container, the Webview control can determine the request message carrying the same communication identifier as the response message, wherein the response message is the message of the request message determined by the Webview container in response to the response message. Furthermore, the Webview control can determine a processing result including the time of sending the determined request packet and the time of receiving the response packet.
An embodiment of the present invention further provides an electronic device, as shown in fig. 7, including a processor 701, a communication interface 702, a memory 703 and a communication bus 704, where the processor 701, the communication interface 702, and the memory 703 complete mutual communication through the communication bus 704,
a memory 703 for storing a computer program;
the processor 701 is configured to implement the following steps when executing the program stored in the memory 703:
sending a first request message carrying a first communication identifier to a Webview container in the client, wherein the first communication identifier is used for representing the uniqueness of the first request message;
and when a first response message which is sent by the Webview container according to the first request message and carries the first communication identifier is received, determining a processing result of the first request message, wherein the processing result comprises the time of sending the first request message and the time of receiving the first response message.
An embodiment of the present invention further provides an electronic device, as shown in fig. 8, which includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804, where the processor 801, the communication interface 802, and the memory 803 complete mutual communication through the communication bus 804,
a memory 803 for storing a computer program;
the processor 801 is configured to implement the following steps when executing the program stored in the memory 803:
receiving a first request message which is sent by a Webview control in the client and carries a first communication identifier, wherein the first communication identifier is used for representing the uniqueness of the first request message;
and sending a first response message carrying the first communication identifier to the Webview control so that the Webview control determines a processing result of the first request message according to the first response message, wherein the processing result comprises the time when the Webview control sends the first request message and the time when the Webview control receives the first response message.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
Based on the processing, the request message sent by the Webview control to the Webview container carries the communication identifier, after the Webview container receives the request message, the Webview container can send a response message carrying the same communication identifier to the Webview control according to the communication identifier carried by the request message, and further, after receiving the response message sent by the Webview container, the Webview control can determine the request message carrying the same communication identifier as the response message, wherein the response message is the message of the request message determined by the Webview container in response to the response message. Furthermore, the Webview control can determine a processing result including the time of sending the determined request packet and the time of receiving the response packet.
In yet another embodiment provided by the present invention, a computer-readable storage medium is further provided, which has instructions stored therein, and when the computer-readable storage medium runs on a computer, the computer is caused to execute the steps of the data communication method applied to the Webview control in the client provided in the above-mentioned embodiment.
Specifically, the data communication method applied to the Webview control in the client comprises the following steps:
sending a first request message carrying a first communication identifier to a Webview container in the client, wherein the first communication identifier is used for representing the uniqueness of the first request message;
and when a first response message which is sent by the Webview container according to the first request message and carries the first communication identifier is received, determining a processing result of the first request message, wherein the processing result comprises the time of sending the first request message and the time of receiving the first response message.
In yet another embodiment provided by the present invention, a computer-readable storage medium is also provided, which has instructions stored therein, which when run on a computer, cause the computer to perform the steps of the data communication method applied to the Webview container in the client provided in the above-mentioned embodiment.
Specifically, the data communication method applied to the Webview container in the client comprises the following steps:
receiving a first request message which is sent by a Webview control in the client and carries a first communication identifier, wherein the first communication identifier is used for representing the uniqueness of the first request message;
and sending a first response message carrying the first communication identifier to the Webview control so that the Webview control determines a processing result of the first request message according to the first response message, wherein the processing result comprises the time when the Webview control sends the first request message and the time when the Webview control receives the first response message.
Based on the processing, the request message sent by the Webview control to the Webview container carries the communication identifier, after the Webview container receives the request message, the Webview container can send a response message carrying the same communication identifier to the Webview control according to the communication identifier carried by the request message, and further, after receiving the response message sent by the Webview container, the Webview control can determine the request message carrying the same communication identifier as the response message, wherein the response message is the message of the request message determined by the Webview container in response to the response message. Furthermore, the Webview control can determine a processing result including the time of sending the determined request packet and the time of receiving the response packet.
In yet another embodiment provided by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the steps of the data communication method applied to the Webview control in the client provided in the above embodiment.
Specifically, the data communication method applied to the Webview control in the client comprises the following steps:
sending a first request message carrying a first communication identifier to a Webview container in the client, wherein the first communication identifier is used for representing the uniqueness of the first request message;
and when a first response message which is sent by the Webview container according to the first request message and carries the first communication identifier is received, determining a processing result of the first request message, wherein the processing result comprises the time of sending the first request message and the time of receiving the first response message.
In yet another embodiment provided by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the steps of the data communication method applied to the Webview container in the client provided in the above embodiment.
Specifically, the data communication method applied to the Webview container in the client comprises the following steps:
receiving a first request message which is sent by a Webview control in the client and carries a first communication identifier, wherein the first communication identifier is used for representing the uniqueness of the first request message;
and sending a first response message carrying the first communication identifier to the Webview control so that the Webview control determines a processing result of the first request message according to the first response message, wherein the processing result comprises the time when the Webview control sends the first request message and the time when the Webview control receives the first response message.
Based on the processing, the request message sent by the Webview control to the Webview container carries the communication identifier, after the Webview container receives the request message, the Webview container can send a response message carrying the same communication identifier to the Webview control according to the communication identifier carried by the request message, and further, after receiving the response message sent by the Webview container, the Webview control can determine the request message carrying the same communication identifier as the response message, wherein the response message is the message of the request message determined by the Webview container in response to the response message. Furthermore, the Webview control can determine a processing result including the time of sending the determined request packet and the time of receiving the response packet.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
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.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, the electronic device, the computer-readable storage medium, and the computer program product embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (12)

1. A data communication method is applied to a web browsing (Webview) control in a client, and comprises the following steps:
sending a first request message carrying a first communication identifier to a Webview container in the client, wherein the first communication identifier is used for representing the uniqueness of the first request message;
and when a first response message which is sent by the Webview container according to the first request message and carries the first communication identifier is received, determining a processing result of the first request message, wherein the processing result comprises the time of sending the first request message and the time of receiving the first response message.
2. The method according to claim 1, wherein before the sending the first request packet carrying the first communication identifier to the Webview container in the client, the method further comprises:
and generating the first communication identifier based on the moment of sending the first request message, the browser fingerprint of the Webview control and the random character string.
3. The method according to claim 1, wherein after the sending the first request packet carrying the first communication identifier to the Webview container in the client, the method further comprises:
storing the first communication identifier in an unresponsive queue, wherein the unresponsive queue is used for recording the communication identifier of the request message of which the corresponding response message is not received;
when the preset detection time is reached, aiming at each communication identifier recorded in the unresponsive queue, calculating the time length between the time of sending the request message corresponding to the communication identifier and the current time;
and if the calculated time length is longer than the preset time length, marking the overtime processing of the request message corresponding to the communication identification.
4. The method of claim 3, further comprising:
storing a callback function corresponding to the first request message in the unresponsive queue, wherein the callback function corresponding to the first request message is used for processing the first response message corresponding to the first request message;
when the first response message is received, judging whether the first request message is marked as processing overtime;
and if the first request message is not marked as processing overtime, analyzing and processing the first response message according to a callback function corresponding to the first request message.
5. The method according to claim 3, wherein after the calculating the time length between the time of sending the request packet corresponding to the communication identifier and the current time, the method further comprises:
and if the calculated time length is longer than the preset time length, displaying a prompt message of the overtime processing of the request message corresponding to the communication identification in a user interface of the client.
6. A data communication method is applied to a web browsing (Webview) container in a client, and comprises the following steps:
receiving a first request message which is sent by a Webview control in the client and carries a first communication identifier, wherein the first communication identifier is used for representing the uniqueness of the first request message;
and sending a first response message carrying the first communication identifier to the Webview control so that the Webview control determines a processing result of the first request message according to the first response message, wherein the processing result comprises the time when the Webview control sends the first request message and the time when the Webview control receives the first response message.
7. A data communication apparatus, the apparatus being applied to a Webview control in a client, the apparatus comprising:
a sending module, configured to send a first request packet carrying a first communication identifier to a Webview container in the client, where the first communication identifier is used to indicate uniqueness of the first request packet;
and the determining module is used for determining a processing result of the first request message when receiving a first response message which is sent by the Webview container according to the first request message and carries the first communication identifier, wherein the processing result comprises the time of sending the first request message and the time of receiving the first response message.
8. A data communication apparatus, wherein the apparatus is applied to a Webview container in a client, the apparatus comprising:
a receiving module, configured to receive a first request packet that is sent by a Webview control in the client and carries a first communication identifier, where the first communication identifier is used to indicate uniqueness of the first request packet;
and the sending module is used for sending a first response message carrying the first communication identifier to the Webview control so that the Webview control determines a processing result of the first request message according to the first response message, wherein the processing result comprises the time when the Webview control sends the first request message and the time when the Webview control receives the first response message.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
10. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of claim 6 when executing a program stored in the memory.
11. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-5.
12. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of claim 6.
CN201911338113.1A 2019-12-23 2019-12-23 Data communication method and device Pending CN111010447A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911338113.1A CN111010447A (en) 2019-12-23 2019-12-23 Data communication method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911338113.1A CN111010447A (en) 2019-12-23 2019-12-23 Data communication method and device

Publications (1)

Publication Number Publication Date
CN111010447A true CN111010447A (en) 2020-04-14

Family

ID=70117590

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911338113.1A Pending CN111010447A (en) 2019-12-23 2019-12-23 Data communication method and device

Country Status (1)

Country Link
CN (1) CN111010447A (en)

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080094206A1 (en) * 2002-07-09 2008-04-24 Neology, Inc. System and Method for Providing Secure Identification Solutions
US20120166586A1 (en) * 2004-12-08 2012-06-28 B-Obvious Ltd. Bidirectional data transfer optimization and content control for networks
CN103636166A (en) * 2011-07-06 2014-03-12 国际商业机器公司 Dynamic data-protection policies associated with a request-reply message queuing environment
CN103955507A (en) * 2014-04-25 2014-07-30 中国联合网络通信集团有限公司 Early warning method and device based on perception of user
US20160173486A1 (en) * 2014-12-12 2016-06-16 Medidata Solutions, Inc. Method and system for automating submission of issue reports
CN106130827A (en) * 2016-08-30 2016-11-16 杭州迪普科技有限公司 The detection method of network equipment accessibility and device
CN106790130A (en) * 2016-12-27 2017-05-31 中国建设银行股份有限公司 A kind of message matching method and device
CN107547619A (en) * 2017-06-19 2018-01-05 新华三技术有限公司 A kind of timer parameter machinery of consultation and device
CN108880765A (en) * 2017-05-10 2018-11-23 中兴通讯股份有限公司 Carrier wave authorization method and device
CN109768918A (en) * 2019-01-16 2019-05-17 北京众纳鑫海网络技术有限公司 For realizing the method and apparatus of instant messaging
CN109815256A (en) * 2018-12-21 2019-05-28 聚好看科技股份有限公司 A kind of data processing method, device, electronic equipment and storage medium
CN109862443A (en) * 2019-03-15 2019-06-07 四川长虹电器股份有限公司 A kind of scheme optimizing television set network settings
CN110099078A (en) * 2018-01-29 2019-08-06 阿里巴巴集团控股有限公司 Communication between devices, message synchronization method, apparatus, equipment and storage medium
CN110198328A (en) * 2018-03-05 2019-09-03 腾讯科技(深圳)有限公司 Client recognition methods, device, computer equipment and storage medium

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080094206A1 (en) * 2002-07-09 2008-04-24 Neology, Inc. System and Method for Providing Secure Identification Solutions
US20120166586A1 (en) * 2004-12-08 2012-06-28 B-Obvious Ltd. Bidirectional data transfer optimization and content control for networks
CN103636166A (en) * 2011-07-06 2014-03-12 国际商业机器公司 Dynamic data-protection policies associated with a request-reply message queuing environment
CN103955507A (en) * 2014-04-25 2014-07-30 中国联合网络通信集团有限公司 Early warning method and device based on perception of user
US20160173486A1 (en) * 2014-12-12 2016-06-16 Medidata Solutions, Inc. Method and system for automating submission of issue reports
CN106130827A (en) * 2016-08-30 2016-11-16 杭州迪普科技有限公司 The detection method of network equipment accessibility and device
CN106790130A (en) * 2016-12-27 2017-05-31 中国建设银行股份有限公司 A kind of message matching method and device
CN108880765A (en) * 2017-05-10 2018-11-23 中兴通讯股份有限公司 Carrier wave authorization method and device
CN107547619A (en) * 2017-06-19 2018-01-05 新华三技术有限公司 A kind of timer parameter machinery of consultation and device
CN110099078A (en) * 2018-01-29 2019-08-06 阿里巴巴集团控股有限公司 Communication between devices, message synchronization method, apparatus, equipment and storage medium
CN110198328A (en) * 2018-03-05 2019-09-03 腾讯科技(深圳)有限公司 Client recognition methods, device, computer equipment and storage medium
CN109815256A (en) * 2018-12-21 2019-05-28 聚好看科技股份有限公司 A kind of data processing method, device, electronic equipment and storage medium
CN109768918A (en) * 2019-01-16 2019-05-17 北京众纳鑫海网络技术有限公司 For realizing the method and apparatus of instant messaging
CN109862443A (en) * 2019-03-15 2019-06-07 四川长虹电器股份有限公司 A kind of scheme optimizing television set network settings

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
张伟: "基于Hash存储的高效DNS缓存系统", 《计算机工程与设计》 *
方涛,樊越甫: "《智能变电站继电保护技术应用研究》", 30 June 2019 *

Similar Documents

Publication Publication Date Title
CN109889547B (en) Abnormal network equipment detection method and device
CN113489713B (en) Network attack detection method, device, equipment and storage medium
CN109194671B (en) Abnormal access behavior identification method and server
CN109213604B (en) Data source management method and device
CN110888838B (en) Request processing method, device, equipment and storage medium based on object storage
US11012339B2 (en) Web site reachability management for content browsing
CN107992738B (en) Account login abnormity detection method and device and electronic equipment
CN111416811A (en) Unauthorized vulnerability detection method, system, equipment and storage medium
CN109450969B (en) Method and device for acquiring data from third-party data source server and server
CN104601601A (en) Web crawler detecting method and device
CN109067794B (en) Network behavior detection method and device
CN113518077A (en) Malicious web crawler detection method, device, equipment and storage medium
CN107103243B (en) Vulnerability detection method and device
CN110430070B (en) Service state analysis method, device, server, data analysis equipment and medium
CN109600254B (en) Method for generating full-link log and related system
CN112084501B (en) Malicious program detection method and device, electronic equipment and storage medium
CN110768865B (en) Deep packet inspection engine activation method and device and electronic equipment
CN110309028B (en) Monitoring information acquisition method, service monitoring method, device and system
CN111241547B (en) Method, device and system for detecting override vulnerability
CN106611118B (en) Method and device for applying login credentials
CN108390770B (en) Information generation method and device and server
CN111010447A (en) Data communication method and device
CN112866265B (en) CSRF attack protection method and device
CN115051867A (en) Detection method and device for illegal external connection behaviors, electronic equipment and medium
CN108920589B (en) Browsing hijacking identification method, device, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200414