CN110086814B - Data acquisition method and device and storage medium - Google Patents

Data acquisition method and device and storage medium Download PDF

Info

Publication number
CN110086814B
CN110086814B CN201910360917.5A CN201910360917A CN110086814B CN 110086814 B CN110086814 B CN 110086814B CN 201910360917 A CN201910360917 A CN 201910360917A CN 110086814 B CN110086814 B CN 110086814B
Authority
CN
China
Prior art keywords
data packet
application
data
web page
webpage
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
CN201910360917.5A
Other languages
Chinese (zh)
Other versions
CN110086814A (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.)
Guangzhou Kugou Computer Technology Co Ltd
Original Assignee
Guangzhou Kugou Computer 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 Guangzhou Kugou Computer Technology Co Ltd filed Critical Guangzhou Kugou Computer Technology Co Ltd
Priority to CN201910360917.5A priority Critical patent/CN110086814B/en
Publication of CN110086814A publication Critical patent/CN110086814A/en
Application granted granted Critical
Publication of CN110086814B publication Critical patent/CN110086814B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/972Access to data in other repository systems, e.g. legacy data or dynamic Web page generation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • 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)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a data acquisition method, a data acquisition device and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: when a data packet from a server is received and a currently displayed webpage is a webpage in a webpage end, acquiring a target data packet identifier of the data packet; and when the stored plurality of data packet identifications comprise target data packet identifications, forwarding the data packets to the webpage end, wherein the plurality of data packet identifications are used for indicating the data packets which need to be forwarded to the webpage end. Therefore, the webpage side obtains data by multiplexing the connection established between the application and the server, the need of additionally establishing a connection is avoided, the flow of the server is reduced, and the burden of the server is reduced.

Description

Data acquisition method and device and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for data acquisition, and a storage medium.
Background
For some types of web page terminals, a connection may be established between the web page terminal and the server through a full duplex communication protocol, where the full duplex communication protocol may enable a persistent connection to be established between the web page terminal and the server, for example, the full duplex communication protocol is a websocket protocol, and the connection established at this time is a socket connection, so that the web page terminal acquires data through the socket connection.
Currently, the netpage side can be embedded into some APP (Application), so that the netpage side of this type is loaded through APP. In some scenarios, the APP may need to establish a socket connection with the server by using a method provided by a bottom layer architecture, and when the APP opens a webpage in the webpage end of the type, the webpage end also needs to establish the socket connection with the server, so that the APP and the webpage end of the type acquire data through the respective established connections, which increases the traffic of the server, thereby increasing the load of the server.
Disclosure of Invention
The embodiment of the application provides a data acquisition method, a data acquisition device and a storage medium, which can solve the problem that server traffic is increased due to the fact that two connections are established in the related art, and therefore server burden is increased. The technical scheme is as follows:
in one aspect, a method for acquiring data is provided, and is applied to an application, where the application can load a web page end that uses a full-duplex communication protocol to transmit data, and the method includes:
when a data packet from a server is received and a currently displayed webpage is a webpage in the webpage end, acquiring a target data packet identifier of the data packet;
and when the stored multiple data packet identifications comprise the target data packet identification, forwarding the data packet to the webpage end, wherein the multiple data packet identifications are used for indicating the data packet which needs to be forwarded to the webpage end.
In a possible implementation manner of the present application, before forwarding the data packet to the web page end when the stored multiple data packet identifiers include the target data packet identifier, the method further includes:
receiving a subscription request of the webpage end, wherein the subscription request comprises the plurality of data packet identifications, and the subscription request is used for indicating that the data packets corresponding to the plurality of data packet identifications need to be forwarded to the webpage end;
storing the plurality of data packet identifications.
In a possible implementation manner of this application, the obtaining the target packet identifier of the packet includes:
acquiring data in a reference field of the data packet;
and determining the acquired data as the target data packet identifier of the data packet.
In a possible implementation manner of the present application, the reference field includes any one field in the data packet, or the reference field includes at least two fields in any data packet.
In a possible implementation manner of the present application, when the reference field includes any one field in the data packet, the reference field is a cmd field; alternatively, the first and second electrodes may be,
when the reference field includes at least two arbitrary fields in the data packet, the reference field is a cmd field and a behavior identification field.
In a possible implementation manner of the present application, the web page in the web page end is an H5 page.
In another aspect, a computer-readable storage medium having instructions stored thereon, which, when executed on a computer, cause the computer to perform the steps of any of the methods of the above aspects, is provided.
In another aspect, a computer program product comprising instructions which, when run on a computer, cause the computer to perform any of the methods of one aspect described above.
In another aspect, a method for acquiring data is provided, where the method is applied to a web page side, the web page side transmits data using a full duplex communication protocol, and the web page side can be loaded in an application, and the method includes:
receiving a data packet sent by an application, wherein the application refers to the application for loading the webpage end;
the data packet is received by the application in the process of displaying the webpage in the webpage end, and is sent after a plurality of stored data packet identifications including the target data packet identification of the data packet are determined, wherein the data packet identifications are used for indicating the data packet which needs to be forwarded to the webpage end.
In a possible implementation manner of the present application, before receiving a data packet sent by an application, the method includes:
sending a subscription request to the application, where the subscription request includes the multiple data packet identifiers, and the subscription request is used to indicate that data packets corresponding to the multiple data packet identifiers need to be forwarded to the web page side, so that the application stores the multiple data packet identifiers.
In one possible implementation manner of the present application, the target data packet is identified as data in a reference field of the data packet.
In a possible implementation manner of the present application, the reference field includes any one field or at least two fields in the data packet, or the reference field includes at least two fields in the data packet.
In one possible implementation manner of the present application, when the reference field includes any one of the fields in the data packet, the reference field is a cmd field, or,
when the reference field includes at least two arbitrary fields in the data packet, the reference field is a cmd field and a behavior identification field.
In a possible implementation manner of the present application, the web page in the web page end is an H5 page.
In another aspect, a computer-readable storage medium is provided, having stored thereon instructions, which, when executed on a computer, cause the computer to perform the steps of any of the above described method of the other aspect.
In another aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform any of the methods of the above further aspects.
In another aspect, an apparatus for data acquisition is provided, where the apparatus is applied in an application, where the application is capable of loading a web page end that uses a full duplex communication protocol to transmit data, and the apparatus includes:
the acquisition module is used for acquiring a target data packet identifier of a data packet when the data packet from a server is received and a currently displayed webpage is a webpage in the webpage end;
and the forwarding module is used for forwarding the data packet to the webpage end when the stored multiple data packet identifications comprise the target data packet identification, and the multiple data packet identifications are used for indicating the data packet which needs to be forwarded to the webpage end.
In one possible implementation manner of the present application, the forwarding module is further configured to:
receiving a subscription request of the webpage end, wherein the subscription request comprises the plurality of data packet identifications, and the subscription request is used for indicating that the data packets corresponding to the plurality of data packet identifications need to be forwarded to the webpage end;
storing the plurality of data packet identifications.
In one possible implementation manner of the present application, the obtaining module is configured to:
acquiring data in a reference field of the data packet;
and determining the acquired data as the target data packet identifier of the data packet.
In a possible implementation manner of the present application, the reference field includes any one field in the data packet, or the reference field includes at least two fields in any data packet.
In a possible implementation manner of the present application, when the reference field includes any one field in the data packet, the reference field is a cmd field; alternatively, the first and second electrodes may be,
when the reference field includes at least two arbitrary fields in the data packet, the reference field is a cmd field and a behavior identification field.
In a possible implementation manner of the present application, the web page in the web page end is an H5 page.
In another aspect, an apparatus for data acquisition is provided, where the apparatus is applied to a web page side, the web page side transmits data using a full duplex communication protocol, and the web page side can be loaded in an application, and the apparatus includes:
the receiving module is used for receiving a data packet sent by an application, wherein the application refers to the application loaded on the webpage end;
the data packet is received by the application in the process of displaying the webpage in the webpage end, and is sent after a plurality of stored data packet identifications including the target data packet identification of the data packet are determined, wherein the data packet identifications are used for indicating the data packet which needs to be forwarded to the webpage end.
In one possible implementation manner of the present application, the receiving module is further configured to:
sending a subscription request to the application, where the subscription request includes the multiple data packet identifiers, and the subscription request is used to indicate that data packets corresponding to the multiple data packet identifiers need to be forwarded to the web page side, so that the application stores the multiple data packet identifiers.
In one possible implementation manner of the present application, the target data packet is identified as data in a reference field of the data packet.
In a possible implementation manner of the present application, the reference field includes any one field or at least two fields in the data packet, or the reference field includes at least two fields in the data packet.
In one possible implementation manner of the present application, when the reference field includes any one of the fields in the data packet, the reference field is a cmd field, or,
when the reference field includes at least two arbitrary fields in the data packet, the reference field is a cmd field and a behavior identification field.
In a possible implementation manner of the present application, a web page in the web page end is an H5 page.
The technical scheme provided by the embodiment of the application has the following beneficial effects:
when the application receives a data packet from the server and the currently displayed webpage is a webpage in the webpage end, the target data packet identifier of the data packet can be acquired, and whether the stored multiple data packet identifiers include the target data packet identifier or not can be inquired. The application can load a webpage end which uses a full duplex communication protocol to transmit data, and the data packet identifications are used for indicating that the application needs to forward data packets to the webpage end. When the stored data packet identifications comprise the target data packet identification, the data packet is forwarded to the webpage end, so that the webpage end obtains data by multiplexing the connection established between the application and the server, the need of additionally establishing a connection is avoided, the flow of the server is reduced, and the burden of the server is reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, 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 schematic diagram of an implementation environment shown in accordance with an exemplary embodiment;
FIG. 2 is a schematic diagram of an implementation environment shown in accordance with another illustrative embodiment;
FIG. 3 is a flow chart illustrating a method of data acquisition according to an exemplary embodiment;
FIG. 4 is a flow chart illustrating a method of data acquisition according to another exemplary embodiment;
FIG. 5 is a schematic diagram illustrating the structure of a data acquisition device according to an exemplary embodiment;
FIG. 6 is a schematic diagram illustrating the structure of a data acquisition device according to another exemplary embodiment;
fig. 7 is a block diagram illustrating a structure of a terminal according to an exemplary embodiment.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Before describing the data acquisition method provided by the embodiment of the present application in detail, an application scenario and an implementation environment related to the embodiment of the present application will be described first.
First, a brief description is given of an application scenario related to an embodiment of the present application.
Some applications may load a type of web page side, where the type of web page side transmits data using a full duplex communication protocol, in some scenarios, the application may need to establish a socket connection with a server, and when an application opens a web page in the type of web page side, the web page side also needs to establish a socket connection with the server, so that the application and the web page side establish a socket connection with the server respectively, and data is acquired through the respective established connections, which may increase traffic of the server, thereby increasing a load of the server. Therefore, embodiments of the present application provide a method for acquiring data, which can solve this problem, and please refer to the following embodiments for specific implementation.
Next, a brief description is given of an implementation environment provided by an embodiment of the present application.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating an implementation environment according to an exemplary embodiment, where the implementation environment mainly includes a terminal 101 and a server 102.
The terminal 101 may install the application, and the application may be a live application, for example. As an example, the terminal 101 may be a mobile phone, a tablet computer, a notebook computer, a desktop computer, a portable computer, and the like, which is not limited in this embodiment.
The server 102 may provide a background service for the application, and may also provide a service for the web page. As an example, the server 102 may be capable of establishing a socket connection with the terminal, and may also be capable of establishing a connection other than the socket connection with the terminal 101. As an example, after the terminal 101 establishes a socket connection with the server 102, the terminal 101 may directly perform data transmission with the server 102, that is, directly obtain data from the server 102.
As an example, the server 102 may be a server, or the server 102 may also be a server cluster composed of multiple servers, which is not limited in this embodiment of the present application.
It should be noted that the above-mentioned establishment of a socket connection between the terminal 101 and the server 102 actually means establishment of a socket connection between an application in the terminal 101 and the server 102.
In addition, the above is described by taking an example that the server 102 can establish a socket connection with the terminal 101 as an example, in another embodiment, the server 102 can also establish a socket connection with the terminal 101 through other devices, for example, please refer to fig. 2, the implementation environment can further include the socket server 103, and at this time, the server 102 can also establish a socket connection with the terminal 101 through the socket server 103. In this case, the socket server 103 can play a role of data forwarding in the implementation environment, that is, when any request is sent to the server by the terminal 101, the request can be sent to the socket server 103, after receiving the request sent by the terminal 101, the socket server 103 forwards the request to the server 102, after receiving the request, the server 102 sends the data requested by the terminal 101 to the socket server 103, and the socket server 103 forwards the data to the terminal 101, so that data transmission between the terminal 101 and the server 102 can be realized.
Fig. 3 is a flow chart illustrating a method for data acquisition according to an exemplary embodiment, which is described by way of example as being applied to the implementation environment shown in fig. 1, and may include the following steps:
step 301: and when the application receives the data packet from the server and the currently displayed webpage is the webpage of the webpage end, acquiring the target data packet identifier of the data packet.
The destination packet id may be used to uniquely indicate a packet, and a packet may include data content for performing a corresponding function.
The web page side transmits data using a full duplex communication protocol, and an application can load the web page side, which may also be referred to as a web side for example. As an example, the web page in the web page end is H5 page.
The full-duplex communication protocol is a protocol that enables two communication parties to send and receive data simultaneously, for example, the full-duplex communication protocol may be a websocket protocol, and as an example, a connection established using the full-duplex communication protocol may be referred to as a socket connection.
In addition, the application can also establish a socket connection with the server when needed to perform certain functions. Since a socket connection can be established between the server and the application, the server can send data to the application. However, when the application sends data to the server, the application may send a data acquisition request of the web page to the server, or send a data acquisition request of the application itself to the server, so that the application receives a data packet from the server, which may or may not be a data packet required by the web page, so that the application needs to acquire a target data packet identifier of the data packet, and determine whether the data packet is a data packet required by the web page.
As an example, the server may send data to the application in parallel, that is, the application may receive multiple data packets from the server at the same time, at this time, the application needs to obtain the destination data packet identifier of each received data packet to determine which of the received data packets are data packets required by the web page side and which are not data packets required by the web page side.
As an example, obtaining the destination packet identifier of the packet may include: and acquiring data in the reference field of the data packet, and determining the acquired data as the target data packet identifier of the data packet.
As an example, the reference field includes any one of the fields in the data packet, or the reference field includes at least two of the fields in the data packet.
As an example, when the reference field includes any one of the fields in the data packet, the reference field is a cmd field; alternatively, when the reference field includes at least two arbitrary fields in the packet, the reference field is a cmd field and a behavior identification field.
Further, before the application receives the data packet from the server, the web page side may send a subscription request to the application, where the subscription request includes a plurality of data packet identifiers, the subscription request is used to indicate that the data packet corresponding to the plurality of data packet identifiers needs to be forwarded to the web page side, and after the application receives the subscription request of the web page side, the application stores the plurality of data packet identifiers.
Step 302: and when the stored plurality of data packet identifications comprise target data packet identifications, the application forwards the data packets to the webpage end, wherein the plurality of data packet identifications are used for indicating the data packets needing to be forwarded to the webpage end.
In some embodiments, after obtaining the target data packet identifier of the data packet, the application may compare the target data packet identifier with the stored multiple data packet identifiers, and when the stored multiple data packet identifiers include the target data packet identifier, determine that the data packet corresponding to the target data packet identifier is a data packet required by the web page, and forward the data packet corresponding to the target data packet identifier and the target data packet identifier to the web page.
In other embodiments, when the application receives a plurality of data packets sent by the server, the target data packet identifier of each received data packet may be compared with the stored plurality of data packet identifiers, when the stored plurality of data packet identifiers include the plurality of target data packet identifiers, it may be determined that the data packet corresponding to the included target data packet identifier is a data packet required by the web page, and the application forwards the data packet corresponding to the included target data packet identifier to the web page.
If the stored data packet identifications do not include the target data packet identification, determining that the data packet corresponding to the target data packet identification is not the data packet required by the webpage end, and forwarding the data packet corresponding to the target data packet identification to the webpage end is not required by the application.
Step 303: and the webpage end receives the data packet sent by the application.
The data packet is received by the application in the process of displaying the webpage of the webpage end.
After receiving the data packet sent by the application, the web page end can search the callback function corresponding to the target data packet identifier in the subscription list stored in the web page end according to the target data packet identifier, and based on the data content of the data packet, the web page end realizes the corresponding function of the data packet in the web page end according to the callback function corresponding to the data packet.
In this embodiment of the application, when the application receives a data packet from the server and a currently displayed web page is a web page in the web page end, a target data packet identifier of the data packet may be obtained, and whether the stored multiple data packet identifiers include the target data packet identifier may be queried. The application can load a webpage end which uses a full duplex communication protocol to transmit data, and the data packet identifications are used for indicating that the application needs to forward data packets to the webpage end. When the stored data packet identifications comprise the target data packet identification, the data packet is forwarded to the webpage end, so that the webpage end obtains data by multiplexing the connection established between the application and the server, the need of additionally establishing a connection is avoided, the flow of the server is reduced, and the burden of the server is reduced.
It should be noted that the technical solution of the present application can be realized by the above steps alone, and further, the technical problem is solved.
Fig. 4 is a flow chart of a method for data acquisition according to another exemplary embodiment, which is described by way of example as being applied to the implementation environment shown in fig. 1, and may include the following steps:
step 401: the webpage end sends a subscription request to the application, the subscription request comprises a plurality of data packet identifications, and the subscription request is used for indicating that the data packets corresponding to the data packet identifications need to be forwarded to the webpage end, so that the application stores the data packet identifications.
The packet identifier may be used to uniquely indicate a packet, and a packet may include data content for performing a corresponding function.
The web page side transmits data using a full duplex communication protocol, and an application can load the web page side, which may also be referred to as a web side for example. As an example, the web page in the web page end is H5 page.
The full-duplex communication protocol is a protocol that enables two communication parties to send and receive data simultaneously, for example, the full-duplex communication protocol may be a websocket protocol, and as an example, a connection established using the full-duplex communication protocol may be referred to as a socket connection.
As shown above, the application may load the web page side, so as to open the web page in the web page side. For example, when the application is a live application, a live room can be accessed through the web page. According to different service scenes, the webpage end can realize various different functions, different data packets are generally needed to realize the different functions, the data packets can be set by a developer in advance when the webpage end is developed, and the data packets are generally stored in a server.
In order to avoid the need to establish two socket connections with the server, the web page side may reuse the socket connection established between the application and the server to acquire data. Therefore, the webpage end can subscribe the data packets required by the webpage end in the application in advance, in implementation, the webpage end can send a subscription request to the application, and the subscription request carries a plurality of required data packet identifiers, so that the data packets required to be forwarded to the webpage end are subscribed to the application through the data packet identifiers, namely, the application determines which data packets are required to be forwarded to the webpage end through the data packet identifiers.
In some embodiments, sending the subscription request to the application by the webpage end may include the following two implementations.
The first implementation mode comprises the following steps: and when the webpage end detects the webpage starting operation, sending a subscription request to the application according to the functions which can be realized by the webpage end.
That is, when a web page in the web page side is opened for the first time, the web page side subscribes to the application for the data package. Illustratively, a web page in the web page end may implement functions of picture display, comment, like, video play, and recording, and when the web page end detects a start operation on an H5 page, a subscription request is sent to an application according to a packet identifier of a packet required to implement the functions, that is, the subscription request may include a packet identifier of a packet required to implement the functions, for example, a packet identifier of a packet required to implement a picture display function, a packet identifier of a packet required to implement a comment function, a packet identifier of a packet required to implement a like function, a packet identifier of a packet required to implement a video play function, and a packet identifier of a packet required to implement a recording function.
The second implementation mode comprises the following steps: and when the webpage detects a trigger operation based on the target subscription option, sending a subscription request to the application according to the trigger operation.
As an example, the triggering operation may be completed by a user, and the triggering operation may be a click operation, a sliding operation, and the like on a subscription option in a web page of the web page end, which is not limited in this embodiment of the present application.
For example, a web page in the web page end may be provided with a subscription option of a video playing function, and when a user clicks the subscription option of the video playing function, the web page end determines that a trigger operation is detected based on a target subscription option, and at this time, sends a subscription request to an application according to a preset data package identifier of a data package required for implementing the video playing function, that is, the subscription request may include the data package identifier of the data package required for implementing the video playing function. Assuming that the data packet identifier of the data packet required for implementing the video playing function is 10, the web page carries the data packet identifier 10 in the subscription request and sends the subscription request to the application.
It should be noted that, the above description is only given by taking the example that the target subscription option includes a subscription option of a video playing function, and in some embodiments, the target subscription option may further include subscription options of a plurality of other functions, which is not limited in this embodiment of the present application.
As an example, the web page side and the application can communicate with each other through a JS bridge (JS bridge).
Further, when the web page side sends the subscription request to the application, the multiple data packet identifications in the subscription request can be stored by themselves, a subscription list is established, and the multiple data packet identifications and the multiple callback functions are stored correspondingly.
It should be noted that the callback function is a JS algorithm of the web page, different data packets correspond to different callback functions, and each data packet can realize a function corresponding to the web page through the corresponding callback function.
Step 402: and the application receives a subscription request of the webpage end and stores a plurality of data packet identifications.
After receiving a subscription request from a web page terminal, an application may parse the subscription request to obtain a plurality of data packet identifiers in the subscription request, and store the plurality of data packet identifiers. Therefore, the application can determine which data packets need to be forwarded to the webpage end according to the plurality of data packet identifications.
Further, after the web page end completes subscription in the application, when a certain function needs to be executed, a data acquisition request can be sent to the server through the application to request to acquire the data packet. That is to say, after subscribing to a data packet corresponding to a plurality of data packet identifiers in an application, when an execution operation of a certain function needs to be executed, a data acquisition request may be sent to the application according to the data packet identifier of the data packet required to implement the function, that is, the data acquisition request carries the data packet identifier of the data packet required to implement the function. After receiving the data acquisition request, the application may send the data acquisition request to the server, and the server may process the data acquisition request and determine a data packet returned to the application according to a data packet identifier carried in the data acquisition request.
Illustratively, a web page may be provided with a picture switching function, and a picture switching option may be provided on a web page in the web page, and when a user clicks the picture switching option, the web page determines that the picture switching function needs to be executed, at this time, the web page may send a data acquisition request to the application, where the data acquisition request carries a packet identifier of a packet required to implement the picture switching function, and it is assumed that the packet identifier of the packet required to implement the picture switching function is 100. After receiving the data acquisition request, the application may send the data acquisition request to the server, and the server may process the data acquisition request, and determine to return a data packet with a data packet identifier of 100 to the application according to the data packet identifier 100 carried in the data acquisition request.
Further, when the application needs some data, it may also send its own data acquisition request to the server to request to acquire the data packet.
Step 403: and when the application receives the data packet from the server and the currently displayed webpage is the webpage in the webpage end, acquiring the target data packet identifier of the data packet.
Since the server establishes a socket connection with the application, the server may send data to the application. However, when the application sends data to the server, the application may send a data acquisition request of the web page to the server, or send a data acquisition request of the application itself to the server, so that the application receives a data packet from the server, which may or may not be a data packet required by the web page, so that the application needs to acquire a target data packet identifier of the data packet, and determine whether the data packet is a data packet required by the web page.
In some embodiments, obtaining the destination packet identification of the packet comprises: and acquiring data in the reference field of the data packet, and determining the acquired data as the target data packet identifier of the data packet.
As an example, for a single data packet, the single data packet may include a reference field and data content implementing the corresponding function. The reference field may include any one of the fields in the data packet, or the reference field may include at least two of any of the fields in the data packet.
As an example, when the reference field includes any one of the fields in the data packet, the reference field may be a cmd field; alternatively, when the reference field includes at least two fields arbitrarily in the packet, the reference field may be a cmd field and a behavior identification field. For example, the behavior identification field may be an actionID field. The reference field may also be different according to different service scenarios, and this is not limited in this embodiment of the present application.
Illustratively, assuming that an application receives a data packet from a server and the currently displayed webpage is an H5 page, the application acquires data in a reference field of the data packet, assuming that the reference field is a cmd field and the data acquired by the application in the cmd field is 10, the acquired data 10 may be determined as a target data packet identifier of the data packet, that is, the application receives a data packet with a data packet identifier of 10 sent by the server.
As an example, the server may send data to the application in parallel, that is, the application may receive multiple data packets from the server at the same time, at this time, the application needs to obtain the destination data packet identifier of each received data packet to determine which of the received data packets are data packets required by the web page side and which are not data packets required by the web page side.
Illustratively, assuming that an application receives four data packets from a server and the currently displayed webpage is an H5 page, the application acquires data in a reference field of each of the four data packets, assuming that the reference field is a cmd field and the data acquired by the application in the cmd field of each data packet is 10, 6, 35, 62, respectively, the acquired data 10, 6, 35, 62 can be determined as target data packet identifications of the four data packets, that is, the application receives a data packet identification 10, a data packet identification 6, a data packet identification 35 and a data packet identification 62 sent by the server.
Step 404: and when the stored plurality of data packet identifications comprise the target data packet identification, the application forwards the data packet to the webpage end.
In some embodiments, after obtaining the target data packet identifier of the data packet, the application may compare the target data packet identifier with the stored multiple data packet identifiers, and when the stored multiple data packet identifiers include the target data packet identifier, determine that the data packet corresponding to the target data packet identifier is a data packet required by the web page, and forward the data packet corresponding to the target data packet identifier and the target data packet identifier to the web page.
Illustratively, assuming that the plurality of data packet identifiers stored by the application are 19, 6, 12, 8 and 26 respectively, and the destination data packet identifier of the data packet acquired by the application from the server is 6, through comparison, it can be determined that the destination data packet identifier 6 is included in the plurality of stored data packet identifiers, so that it can be determined that the data packet identified by the destination data packet identifier 6 is a data packet required by the web page side, and the application forwards the data packet to the web page side.
In other embodiments, when the application receives a plurality of data packets sent by the server, the target data packet identifier of each received data packet may be compared with the stored plurality of data packet identifiers, when the stored plurality of data packet identifiers include the plurality of target data packet identifiers, it may be determined that the data packet corresponding to the included target data packet identifier is a data packet required by the web page side, and the application forwards the included target data packet identifier and the data packet corresponding to the included target data packet identifier to the web page side.
Illustratively, it is assumed that the plurality of packet identifiers stored by the application are 19, 6, 12, 8, 30, 51, 66 and 26, respectively, the target packet identifiers of the plurality of packets acquired by the application from the server are 9, 6, 12 and 33, respectively, and through comparison, it can be determined that the stored plurality of packet identifiers include the packet identifiers 6 and 12, so that the packets with the target packet identifiers of 6 and 12 can be determined as the packets required by the web page side, and the application forwards the two packets to the web page side.
As an example, forwarding a packet to the web page by the application may be a copy and paste behavior, and the packet is still stored in the application, and if the packet is also a packet required by the application, it can be said that multiplexing of data is completed.
If the stored data packet identifications do not include the target data packet identification, determining that the data packet corresponding to the target data packet identification is not the data packet required by the webpage end, and forwarding the data packet corresponding to the target data packet identification to the webpage end is not required by the application.
Exemplarily, assuming that the plurality of data packet identifiers stored by the application are 19, 6, 12, 8 and 26, respectively, and the target data packet identifier of the data packet obtained by the application from the server is 9, through comparison, it can be determined that the target data packet identifier 9 is not included in the plurality of stored data packet identifiers, so that it can be determined that the data packet with the target data packet identifier 9 is not a data packet required by the web page side, and the application does not need to forward the data packet to the web page side; or the application acquires that the target data packet identifiers of the multiple data packets from the server are respectively 1, 8 and 56, and through comparison, it can be determined that the stored multiple data packet identifiers do not include the target data packet identifiers 1, 8 and 56, so that it can be determined that the data packets with the target data packet identifiers 1, 8 and 56 are not data packets required by the web page side, and the application does not need to forward the three data packets to the web page side.
Step 405: and the webpage end receives the data packet sent by the application.
The data packet is received by the application in the process of displaying the webpage in the webpage end.
After receiving the data packet sent by the application, the web page end can search the callback function corresponding to the target data packet identifier in the subscription list stored in the web page end according to the target data packet identifier, and based on the data content of the data packet, the web page end realizes the corresponding function of the data packet in the web page end according to the callback function corresponding to the data packet.
Illustratively, a webpage end receives a data packet sent by an application and a target data packet identifier corresponding to the data packet, assuming that the target data packet identifier of the data packet is 8, the data packet corresponding to the target data packet identifier can complete a comment function, a corresponding callback function is searched in a subscription list stored in the webpage end according to the target data packet identifier 8, and the callback function is called based on the data content of the data packet, so that the comment function can be realized at the webpage end.
Therefore, the webpage side acquires the required data packet through the socket connection established by the application and the server, namely, the webpage side and the application share one connection link, and the multiplexing of the data link is completed.
In this embodiment of the application, when the application receives a data packet from the server and a currently displayed web page is a web page in the web page end, a target data packet identifier of the data packet may be obtained, and whether the stored multiple data packet identifiers include the target data packet identifier may be queried. The application can load a webpage end which uses a full duplex communication protocol to transmit data, and the data packet identifications are used for indicating that the application needs to forward data packets to the webpage end. When the stored data packet identifications comprise the target data packet identification, the data packet is forwarded to the webpage end, so that the webpage end obtains data by multiplexing the connection established between the application and the server, the need of additionally establishing a connection is avoided, the flow of the server is reduced, and the burden of the server is reduced.
Fig. 5 is a schematic diagram illustrating a structure of a data acquisition apparatus according to an exemplary embodiment, which may be implemented by software, hardware, or a combination of both. Referring to fig. 5, the apparatus may include: an acquisition module 501 and a forwarding module 502.
An obtaining module 501, configured to obtain a target data packet identifier of a data packet when the data packet is received from a server and a currently displayed web page is a web page in a web page end;
a forwarding module 502, configured to forward a data packet to the web page end when the stored multiple data packet identifiers include a target data packet identifier, where the multiple data packet identifiers are used to indicate the data packet that needs to be forwarded to the web page end.
In a possible implementation manner of the present application, the forwarding module 502 is further configured to:
receiving a subscription request of a webpage end, wherein the subscription request comprises a plurality of data packet identifications, and the subscription request is used for indicating that data packets corresponding to the plurality of data packet identifications need to be forwarded to the webpage end;
a plurality of packet identifications are stored.
In one possible implementation manner of the present application, the obtaining module 501 is configured to:
acquiring data in a reference field of a data packet;
and determining the acquired data as the target data packet identifier of the data packet.
In one possible implementation manner of the present application, the reference field includes any one field in the data packet, or the reference field includes at least two fields in any data packet.
In one possible implementation manner of the present application, when the reference field includes any one field in the data packet, the reference field is a cmd field; alternatively, the first and second electrodes may be,
when the reference field includes at least two arbitrary fields in the packet, the reference field is a cmd field and a behavior identification field.
In one possible implementation manner of the present application, the web page in the web page end is H5 page.
In this embodiment of the application, when the application receives a data packet from the server and a currently displayed web page is a web page in the web page end, a target data packet identifier of the data packet may be obtained, and whether the stored multiple data packet identifiers include the target data packet identifier may be queried. The application can load a webpage end which uses a full duplex communication protocol to transmit data, and the data packet identifications are used for indicating that the application needs to forward data packets to the webpage end. When the stored data packet identifications comprise the target data packet identification, the data packet is forwarded to the webpage end, so that the webpage end obtains data by multiplexing the connection established between the application and the server, the need of additionally establishing a connection is avoided, the flow of the server is reduced, and the burden of the server is reduced.
It should be noted that: in the data acquisition apparatus provided in the above embodiment, when acquiring data, only the division of the above functional modules is taken as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the above described functions. In addition, the data acquisition device and the data acquisition method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 6 is a schematic structural diagram showing a data acquisition apparatus according to another exemplary embodiment, which may be implemented by software, hardware, or a combination of both. Referring to fig. 6, the apparatus may include: a receiving module 601.
A receiving module 601, configured to receive a data packet sent by an application, where the application refers to an application loaded on a web page side;
the data packets are received by the application in the process of displaying the webpage in the webpage end, and are sent after the stored data packet identifications are determined to comprise the target data packet identification of the data packet, wherein the data packet identifications are used for indicating the data packet which needs to be forwarded to the webpage end.
In one possible implementation manner of the present application, the receiving module 601 is further configured to:
and sending a subscription request to the application, wherein the subscription request comprises a plurality of data packet identifiers, and the subscription request is used for indicating that the data packets corresponding to the plurality of data packet identifiers need to be forwarded to the webpage end, so that the application stores the plurality of data packet identifiers.
In one possible implementation of the present application, the destination packet is identified as data in a reference field of the packet.
In one possible implementation manner of the present application, the reference field includes any one field or at least two fields in the data packet, or the reference field includes any at least two fields in the data packet.
In one possible implementation of the present application, when the reference field includes any one of the fields in the data packet, the reference field is a cmd field, or,
when the reference field includes at least two arbitrary fields in the packet, the reference field is a cmd field and a behavior identification field.
In one possible implementation manner of the present application, the web page in the web page end is H5 page.
In this embodiment of the application, when the application receives a data packet from the server and a currently displayed web page is a web page in the web page end, a target data packet identifier of the data packet may be obtained, and whether the stored multiple data packet identifiers include the target data packet identifier may be queried. The application can load a webpage end which uses a full duplex communication protocol to transmit data, and the data packet identifications are used for indicating that the application needs to forward data packets to the webpage end. When the stored data packet identifications comprise the target data packet identification, the data packet is forwarded to the webpage end, so that the webpage end obtains data by multiplexing the connection established between the application and the server, the need of additionally establishing a connection is avoided, the flow of the server is reduced, and the burden of the server is reduced.
It should be noted that: in the data acquisition apparatus provided in the above embodiment, when acquiring data, only the division of the above functional modules is taken as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the above described functions. In addition, the data acquisition device and the data acquisition method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 7 shows a block diagram of a terminal 700 according to an exemplary embodiment of the present application. The terminal can install the application so that the application can realize the data acquisition method. The terminal 700 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 4), a notebook computer, or a desktop computer. Terminal 700 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, and so on.
In general, terminal 700 includes: a processor 701 and a memory 702.
The processor 701 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor 701 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 701 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 701 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 701 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 702 may include one or more computer-readable storage media, which may be non-transitory. Memory 702 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 702 is used to store at least one instruction for execution by processor 701 to implement a method provided by method embodiments herein.
In some embodiments, the terminal 700 may further optionally include: a peripheral interface 703 and at least one peripheral. The processor 701, the memory 702, and the peripheral interface 703 may be connected by buses or signal lines. Various peripheral devices may be connected to peripheral interface 703 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 704, touch screen display 705, camera 706, audio circuitry 707, positioning components 708, and power source 709.
The peripheral interface 703 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 701 and the memory 702. In some embodiments, processor 701, memory 702, and peripheral interface 703 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 701, the memory 702, and the peripheral interface 703 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
The Radio Frequency circuit 704 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 704 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 704 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 704 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 704 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 704 may also include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 705 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 705 is a touch display screen, the display screen 705 also has the ability to capture touch signals on or over the surface of the display screen 705. The touch signal may be input to the processor 701 as a control signal for processing. At this point, the display 705 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 705 may be one, providing the front panel of the terminal 700; in other embodiments, the display 705 can be at least two, respectively disposed on different surfaces of the terminal 700 or in a folded design; in still other embodiments, the display 705 may be a flexible display disposed on a curved surface or on a folded surface of the terminal 700. Even more, the display 705 may be arranged in a non-rectangular irregular pattern, i.e. a shaped screen. The Display 705 may be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or the like.
The camera assembly 706 is used to capture images or video. Optionally, camera assembly 706 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 706 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
The audio circuitry 707 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 701 for processing or inputting the electric signals to the radio frequency circuit 704 to realize voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the terminal 700. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 701 or the radio frequency circuit 704 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, the audio circuitry 707 may also include a headphone jack.
The positioning component 708 is used to locate the current geographic Location of the terminal 700 for navigation or LBS (Location Based Service). The Positioning component 708 can be a Positioning component based on the Global Positioning System (GPS) in the united states, the beidou System in china, or the galileo System in russia.
Power supply 709 is provided to supply power to various components of terminal 700. The power source 709 may be alternating current, direct current, disposable batteries, or rechargeable batteries. When the power source 709 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 700 also includes one or more sensors 710. The one or more sensors 710 include, but are not limited to: acceleration sensor 711, gyro sensor 712, pressure sensor 713, fingerprint sensor 714, optical sensor 715, and proximity sensor 716.
The acceleration sensor 711 can detect the magnitude of acceleration in three coordinate axes of a coordinate system established with the terminal 700. For example, the acceleration sensor 711 may be used to detect components of the gravitational acceleration in three coordinate axes. The processor 701 may control the touch screen 705 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 711. The acceleration sensor 711 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 712 may detect a body direction and a rotation angle of the terminal 700, and the gyro sensor 712 may cooperate with the acceleration sensor 711 to acquire a 3D motion of the terminal 700 by the user. From the data collected by the gyro sensor 712, the processor 701 may implement the following functions: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
Pressure sensors 713 may be disposed on a side bezel of terminal 700 and/or an underlying layer of touch display 705. When the pressure sensor 713 is disposed on a side frame of the terminal 700, a user's grip signal on the terminal 700 may be detected, and the processor 701 performs right-left hand recognition or shortcut operation according to the grip signal collected by the pressure sensor 713. When the pressure sensor 713 is disposed at a lower layer of the touch display 705, the processor 701 controls the operability control on the UI interface according to the pressure operation of the user on the touch display 705. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 714 is used for collecting a fingerprint of a user, and the processor 701 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 714, or the fingerprint sensor 714 identifies the identity of the user according to the collected fingerprint. When the user identity is identified as a trusted identity, the processor 701 authorizes the user to perform relevant sensitive operations, including unlocking a screen, viewing encrypted information, downloading software, paying, changing settings, and the like. The fingerprint sensor 714 may be disposed on the front, back, or side of the terminal 700. When a physical button or a vendor Logo is provided on the terminal 700, the fingerprint sensor 714 may be integrated with the physical button or the vendor Logo.
The optical sensor 715 is used to collect the ambient light intensity. In one embodiment, the processor 701 may control the display brightness of the touch display 705 based on the ambient light intensity collected by the optical sensor 715. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 705 is increased; when the ambient light intensity is low, the display brightness of the touch display 705 is turned down. In another embodiment, processor 701 may also dynamically adjust the shooting parameters of camera assembly 706 based on the ambient light intensity collected by optical sensor 715.
A proximity sensor 716, also referred to as a distance sensor, is typically disposed on a front panel of the terminal 700. The proximity sensor 716 is used to collect the distance between the user and the front surface of the terminal 700. In one embodiment, when the proximity sensor 716 detects that the distance between the user and the front surface of the terminal 700 gradually decreases, the processor 701 controls the touch display 705 to switch from the bright screen state to the dark screen state; when the proximity sensor 716 detects that the distance between the user and the front surface of the terminal 700 gradually becomes larger, the processor 701 controls the touch display 705 to switch from the breath screen state to the bright screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 7 is not intended to be limiting of terminal 700 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
Embodiments of the present application further provide a non-transitory computer-readable storage medium, where instructions in the storage medium, when executed by a processor of a mobile terminal, enable the mobile terminal to perform the methods provided in the foregoing embodiments.
The embodiments of the present application also provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the methods provided by the above 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 exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (15)

1. A data acquisition method is applied to an application, wherein the application can load a webpage end which uses a full-duplex communication protocol to transmit data, and the method comprises the following steps:
when a data packet from a server is received and a currently displayed webpage is a webpage in the webpage end, acquiring a target data packet identifier of the data packet;
and when the stored multiple data packet identifications comprise the target data packet identification, forwarding the data packet to the webpage end, wherein the multiple data packet identifications are used for indicating the data packet which needs to be forwarded to the webpage end.
2. The method of claim 1, wherein when the stored plurality of packet identifiers includes the destination packet identifier, before forwarding the packet to the web page, further comprising:
receiving a subscription request of the webpage end, wherein the subscription request comprises the plurality of data packet identifications, and the subscription request is used for indicating that the data packets corresponding to the plurality of data packet identifications need to be forwarded to the webpage end;
storing the plurality of data packet identifications.
3. The method of claim 1, wherein said obtaining the destination packet identification of the packet comprises:
acquiring data in a reference field of the data packet, wherein the reference field is a field carrying the identification of the target data packet;
and determining the acquired data as the target data packet identifier of the data packet.
4. The method of claim 3, wherein the reference field comprises any one of the fields in the data packet or the reference field comprises at least two of any of the fields in the data packet.
5. The method of claim 4,
when the reference field comprises any field in the data packet, the reference field is a cmd field, and the cmd field is a field carrying the target data identifier; alternatively, the first and second electrodes may be,
when the reference field includes at least two arbitrary fields in the data packet, the reference field is a cmd field and a behavior identification field, and the cmd field and the behavior identification field are two fields carrying the target data identification.
6. The method of any one of claims 1-5, wherein the web page in the web page end is an H5 page.
7. A data acquisition method is applied to a webpage end, the webpage end uses a full-duplex communication protocol to transmit data, and the webpage end can be loaded in an application, and the method comprises the following steps:
receiving a data packet sent by an application, wherein the application refers to the application for loading the webpage end;
the data packet is received by the application in the process of displaying the webpage in the webpage end, and is sent after a plurality of stored data packet identifications including the target data packet identification of the data packet are determined, wherein the data packet identifications are used for indicating the data packet which needs to be forwarded to the webpage end.
8. The method of claim 7, wherein the receiving the data packet sent by the application comprises:
sending a subscription request to the application, where the subscription request includes the multiple data packet identifiers, and the subscription request is used to indicate that data packets corresponding to the multiple data packet identifiers need to be forwarded to the web page side, so that the application stores the multiple data packet identifiers.
9. The method of claim 7, wherein the data packet includes a reference field, the reference field being a field carrying the target data packet identification.
10. The method of claim 9, wherein the reference field comprises any one field or at least two fields in the data packet, or wherein the reference field comprises any at least two fields in the data packet.
11. The method of claim 10,
when the reference field includes any field in the data packet, the reference field is a cmd field, the cmd field is a field carrying the target data identifier, or,
when the reference field includes at least two arbitrary fields in the data packet, the reference field is a cmd field and a behavior identification field, and the cmd field and the behavior identification field are two fields carrying the target data identification.
12. The method of any one of claims 7-11, wherein the web page in the web page end is an H5 page.
13. A data acquisition apparatus, applied to an application, where the application can load a web page side that uses a full duplex communication protocol to transmit data, the apparatus comprising:
the acquisition module is used for acquiring a target data packet identifier of a data packet when the data packet from a server is received and a currently displayed webpage is a webpage in the webpage end;
and the forwarding module is used for forwarding the data packet to the webpage end when the stored multiple data packet identifications comprise the target data packet identification, and the multiple data packet identifications are used for indicating the data packet which needs to be forwarded to the webpage end.
14. A data acquisition device, for use in a web page, where the web page transmits data using a full duplex communication protocol, and the web page can be loaded in an application, the device comprising:
the receiving module is used for receiving a data packet sent by an application, wherein the application refers to the application loaded on the webpage end;
the data packet is received by the application in the process of displaying the webpage in the webpage end, and is sent after a plurality of stored data packet identifications including the target data packet identification of the data packet are determined, wherein the data packet identifications are used for indicating the data packet which needs to be forwarded to the webpage end.
15. A computer-readable storage medium having stored therein instructions which, when executed on a computer, cause the computer to perform the steps of any of the methods of claims 1-6 or the steps of any of the methods of claims 7-12.
CN201910360917.5A 2019-04-30 2019-04-30 Data acquisition method and device and storage medium Active CN110086814B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910360917.5A CN110086814B (en) 2019-04-30 2019-04-30 Data acquisition method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910360917.5A CN110086814B (en) 2019-04-30 2019-04-30 Data acquisition method and device and storage medium

Publications (2)

Publication Number Publication Date
CN110086814A CN110086814A (en) 2019-08-02
CN110086814B true CN110086814B (en) 2021-11-02

Family

ID=67418094

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910360917.5A Active CN110086814B (en) 2019-04-30 2019-04-30 Data acquisition method and device and storage medium

Country Status (1)

Country Link
CN (1) CN110086814B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110971596A (en) * 2019-11-25 2020-04-07 广州虎牙科技有限公司 Message monitoring method and device, electronic equipment and machine-readable storage medium
CN112738611A (en) * 2020-12-28 2021-04-30 安徽海豚新媒体产业发展有限公司 Short video collection and spread application system

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464886A (en) * 2008-12-19 2009-06-24 上海全景数字技术有限公司 HTML label and attribute expansion method based on built-in browser
WO2013048329A3 (en) * 2011-09-30 2013-06-06 13Th Lab A method for capturing events in front of a camera device
CN103259771A (en) * 2012-02-20 2013-08-21 腾讯科技(深圳)有限公司 Method and device of interaction of network applications
CN107590397A (en) * 2017-09-19 2018-01-16 广州酷狗计算机科技有限公司 A kind of method and apparatus for showing embedded webpage
CN108170723A (en) * 2017-12-07 2018-06-15 维沃移动通信有限公司 A kind of web page resources acquisition methods, terminal device, server and system
CN108600529A (en) * 2018-04-09 2018-09-28 北京小米移动软件有限公司 Information interacting method, device and computer readable storage medium
CN108829868A (en) * 2018-06-22 2018-11-16 腾讯科技(深圳)有限公司 data display method and device, storage medium and electronic device
CN108965365A (en) * 2017-05-27 2018-12-07 腾讯科技(北京)有限公司 A kind of data processing method and terminal, computer storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10375054B2 (en) * 2015-10-06 2019-08-06 Netflix, Inc. Securing user-accessed applications in a distributed computing environment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464886A (en) * 2008-12-19 2009-06-24 上海全景数字技术有限公司 HTML label and attribute expansion method based on built-in browser
WO2013048329A3 (en) * 2011-09-30 2013-06-06 13Th Lab A method for capturing events in front of a camera device
CN103259771A (en) * 2012-02-20 2013-08-21 腾讯科技(深圳)有限公司 Method and device of interaction of network applications
CN108965365A (en) * 2017-05-27 2018-12-07 腾讯科技(北京)有限公司 A kind of data processing method and terminal, computer storage medium
CN107590397A (en) * 2017-09-19 2018-01-16 广州酷狗计算机科技有限公司 A kind of method and apparatus for showing embedded webpage
CN108170723A (en) * 2017-12-07 2018-06-15 维沃移动通信有限公司 A kind of web page resources acquisition methods, terminal device, server and system
CN108600529A (en) * 2018-04-09 2018-09-28 北京小米移动软件有限公司 Information interacting method, device and computer readable storage medium
CN108829868A (en) * 2018-06-22 2018-11-16 腾讯科技(深圳)有限公司 data display method and device, storage medium and electronic device

Also Published As

Publication number Publication date
CN110086814A (en) 2019-08-02

Similar Documents

Publication Publication Date Title
CN111225042B (en) Data transmission method and device, computer equipment and storage medium
CN110308956B (en) Application interface display method and device and mobile terminal
CN111355774B (en) Service communication method, device and system based on P2P
CN110659127A (en) Method, device and system for processing task
CN108848492B (en) Method, device, terminal and storage medium for starting user identity identification card
CN110569220A (en) Game resource file display method and device, terminal and storage medium
CN109783176B (en) Page switching method and device
CN110086814B (en) Data acquisition method and device and storage medium
CN110636144A (en) Data downloading method and device
CN112612539A (en) Data model unloading method and device, electronic equipment and storage medium
CN111324293B (en) Storage system, data storage method, data reading method and device
CN111008083A (en) Page communication method and device, electronic equipment and storage medium
CN110971840A (en) Video mapping method and device, computer equipment and storage medium
CN111914985A (en) Configuration method and device of deep learning network model and storage medium
CN111464829B (en) Method, device and equipment for switching media data and storage medium
CN112597417B (en) Page updating method and device, electronic equipment and storage medium
CN114785766A (en) Control method of intelligent equipment, terminal and server
CN112260845B (en) Method and device for accelerating data transmission
CN110471613B (en) Data storage method, data reading method, device and system
CN112612540A (en) Data model configuration method and device, electronic equipment and storage medium
CN113051015A (en) Page rendering method and device, electronic equipment and storage medium
CN107948171B (en) User account management method and device
CN111010732A (en) Network registration method, device, electronic equipment and medium
CN111694521A (en) Method, device and system for storing file
CN111158791A (en) Configuration file updating method, device and system 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
GR01 Patent grant
GR01 Patent grant