CN106209857B - Data transmission method and device - Google Patents
Data transmission method and device Download PDFInfo
- Publication number
- CN106209857B CN106209857B CN201610555462.9A CN201610555462A CN106209857B CN 106209857 B CN106209857 B CN 106209857B CN 201610555462 A CN201610555462 A CN 201610555462A CN 106209857 B CN106209857 B CN 106209857B
- Authority
- CN
- China
- Prior art keywords
- webpage
- data
- server
- interface
- connection
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/40—Support for services or applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/40—Support for services or applications
- H04L65/4061—Push-to services, e.g. push-to-talk or push-to-video
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a kind of data transmission method and devices.Wherein, this method comprises: the first webpage calls the creation of js logic using the long connection of full duplex communication;First webpage is connected by long to the first data of server transport, wherein the first data are captured to obtain by target webpage, and target webpage is nested in the iframe label of the first webpage;First webpage receives server and passes through the second data of long connection push, second data are generated according to the first data that the first webpage reports, wherein, before the first webpage receives the second data, the first webpage does not send the request of data for requesting the second data to server;First webpage sends the second data to target webpage.The present invention solve can not in real time to the first Web page push message the technical issues of.
Description
Technical field
The present invention relates to field of data transmission, in particular to a kind of data transmission method and device.
Background technique
The prior art generallys use mode of the server active to the first Web page push data when carrying out data transmission,
First webpage is only responsible for receiving the data of server push.The data of server push are that server is received based on multiple first webpages
The data of multiple users of collection obtain, however, the propelling data obtained required for each user is different, existing server without
Method is accurately to user's propelling data.
For above-mentioned problem, currently no effective solution has been proposed.
Summary of the invention
The embodiment of the invention provides a kind of data transmission method and device, at least solve can not accurately propelling data
The technical issues of.
According to an aspect of an embodiment of the present invention, a kind of data transmission method is provided, comprising: opening target webpage
When the first webpage call the creation of js logic using the long connection of full duplex communication, wherein the target webpage is nested in described the
In the iframe label of one webpage;First webpage is connected by the length to the first data of server transport, and described first
Data are captured to obtain by the target webpage;First webpage receives the server by the second of the long connection push
Data, second data are generated according to first data that first webpage reports, wherein are connect in first webpage
Before receiving second data, first webpage is not sent to the server for requesting the data of second data to be asked
It asks;First webpage sends second data to the target webpage.
According to another aspect of an embodiment of the present invention, a kind of data transmission device is additionally provided, comprising: creating unit is used
In the long connection for calling the creation of js logic to use full duplex communication when opening target webpage, wherein the target webpage is nested
In the iframe label of the first webpage;First transmission unit, for being connected by the length to the first data of server transport,
First data are captured to obtain by the target webpage;Second transmission unit passes through the length for receiving the server
The second data of push are connected, second data are generated according to first data that first webpage reports, wherein
Before first webpage receives second data, first webpage is not sent to the server for requesting described the
The request of data of two data;Transmission unit, for sending second data to the target webpage.
In embodiments of the present invention, the second data are generated according to the first data, therefore, to the of the first Web page push
Two data are matched with the first data of the first collecting web page, the behavioural habits or interest at the current family of the first data volume
When preference, data needed for the second data of push can precisely match user, number can not precisely be pushed by solving the prior art
According to the technical issues of.Further, because being communicated between the first webpage and server by the long connection of full duplex communication,
Server can obtain the first data that target webpage captures in real time, also can generate the second number according to the first data in real time
According to, and give the second data-pushing of generation to the first webpage in real time.During the second data of server push, do not need
First webpage and target webpage are also achieved that server in real time to the first Web page push second to server initiation request of data
Data have achieved the effect that real-time, accurate propelling data.
Detailed description of the invention
The drawings described herein are used to provide a further understanding of the present invention, constitutes part of this application, this hair
Bright illustrative embodiments and their description are used to explain the present invention, and are not constituted improper limitations of the present invention.In the accompanying drawings:
Fig. 1 is the schematic diagram of hardware configuration according to an embodiment of the present invention;
Fig. 2 is the flow chart of data transmission method according to an embodiment of the present invention;
Fig. 3 is the timing diagram according to an embodiment of the present invention for establishing connection;
Fig. 4 is that flash according to an embodiment of the present invention realizes that websocket opens the timing diagram of long connection;
Fig. 5 is that the long connection according to an embodiment of the present invention to using flash realization full duplex communication is sent, received
With the timing diagram of closing;
Fig. 6 is the schematic diagram of data transmission device according to an embodiment of the present invention;
Fig. 7 is the schematic diagram of terminal according to embodiments of the present invention.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention
Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only
The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people
The model that the present invention protects all should belong in member's every other embodiment obtained without making creative work
It encloses.
It should be noted that description and claims of this specification and term " first " in above-mentioned attached drawing, "
Two " etc. be to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should be understood that using in this way
Data be interchangeable under appropriate circumstances, so as to the embodiment of the present invention described herein can in addition to illustrating herein or
Sequence other than those of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that cover
Cover it is non-exclusive include, for example, the process, method, system, product or equipment for containing a series of steps or units are not necessarily limited to
Step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, product
Or other step or units that equipment is intrinsic.
Explanation of nouns:
Connection: the virtual communication route that communication two party is established in computer network.
Agreement: communication two party is in the stylistic a kind of agreement of interactive mode and data in computer network.
Full duplex: communication two party can carry out a kind of transmission mode of bidirectional data transfers simultaneously in computer network.
Push in real time: a kind of transmission mode actively sending data to the first webpage from server, different from traditional the
The mode of one web-page requests server response, does not need the request of the first webpage.
Http: hypertext transfer protocol, a kind of widely applied communications protocol.
Websocket: a kind of agreement carrying out full duplex communication in single connection can be saved preferably relative to Http
Server resource and bandwidth simultaneously reach real-time push.
Long connection: the short type of attachment usually used relative to Http refers to that the first webpage and server keep one for a long time
Virtual communication route.
Js code: javascript scripting language provides the basic function of data verification.Javascript increases webpage
Add interactivity.
Iframe, that is, html tag, effect are the documents in document, or the frame to float.Iframe element will create packet
Inline frame containing another document, at once inner frame.
HTML: i.e. hypertext markup language, an application under standard generalized markup language.
Embodiment 1
According to embodiments of the present invention, a kind of embodiment of the method that can be executed by the application Installation practice is provided,
It should be noted that step shown in the flowchart of the accompanying drawings can be in the department of computer science of such as a group of computer-executable instructions
It is executed in system, although also, logical order is shown in flow charts, and it in some cases, can be to be different from herein
Sequence execute shown or described step.
Optionally, in the present embodiment, above-mentioned data transmission method can be applied to 102 kimonos of terminal as shown in Figure 1
In the hardware environment that business device 104 is constituted.As shown in Figure 1, objective terminal 102 is attached by network with server 104, it is above-mentioned
Network includes but is not limited to: mobile communications network, wide area network, Metropolitan Area Network (MAN) or local area network, and terminal 102 can be mobile phone terminal,
It can be PC terminal, notebook terminal or tablet computer terminal.
The first webpage and server 104 in terminal 102 are established the long of full-duplex communication and are connected, and are nested in target webpage
In first webpage, target webpage progress webpage, which jumps page, to be jumped in the first webpage, and jumping for target webpage can't
The connection for influencing the first webpage and server, realizes target webpage and the long of server connects.First webpage passes through long connection
First that target webpage is captured is sent to server 104, and the first webpage passes through long second for connecting reception server 104 and sending
Data, and the second data are sent to target webpage, since the second data are generated according to the first data, the second number
According to the interest and hobby of accurate match user is capable of, to realize accurate propelling data, solving the prior art can not be accurate
The technical issues of propelling data.
A kind of data transmission method is present embodiments provided, which can apply hardware shown in Fig. 1
In environment.
Fig. 2 is the flow chart of data transmission method according to an embodiment of the present invention.As shown in Fig. 2, the data transmission method
Include the following steps:
Step S202, the first webpage call the creation of js logic using the long connection of full duplex communication.
Step S204, the first webpage by long connection to the first data of server transport, caught by the first webpage by the first data
It catches to obtain, target webpage is nested in the iframe label of the first webpage.
Step S206, the first webpage receive server by the second data of long connection push, and the second data are according to first
The first data that webpage reports generate, wherein before the first webpage receives the second data, the first webpage is not sent to server
For requesting the request of data of the second data.
Step S208, the first webpage send the second data to target webpage.
First webpage creates the long connection of full duplex communication, and full duplex communication may be implemented through the long connection of same simultaneously
To server reported data and the data from server are received, and long connection does not need the first webpage to server number of request
According to server can be after establishing long connection, actively to the first Web page push data.
In the present embodiment, the second data are generated according to the first data, therefore, to the second number of the first Web page push
According to being matched with the first data of the first collecting web page, the behavioural habits or interest preference at the current family of the first data volume
When, data needed for the second data of push can precisely match user, solving the prior art can not accurate propelling data
Technical problem.Further, it because being communicated between the first webpage and server by the long connection of full duplex communication, services
Device can obtain the first data that target webpage captures in real time, also can generate the second data according to the first data in real time,
And give the second data-pushing of generation to the first webpage in real time.During the second data of server push, is not needed
One webpage and target webpage are also achieved that server in real time to the first Web page push second number to server initiation request of data
According to having achieved the effect that real-time, accurate propelling data.
In some embodiments, when user A browsing objective webpage, " automobile " relevant information in target webpage is carried out
It clicks, stopped longer time in the advertisement part about automobile, target webpage captures the click behavior and browsing of user A
Residence time (the first data), and server is sent to by the first webpage.Server stops according to click behavior with what is browsed
The time is stayed to determine that user A is interested in automobile, the automobile brand that the relevant advertising information of generation automobile, user pay close attention to
Discount information etc., these information that server generates are sent to the first webpage as the second data, and the first webpage forwards advertisement letter
Breath and discount information are to target webpage.
In other embodiments, when user B browsing objective webpage, in target webpage in target webpage
" cuisines " relevant information click, has stopped longer time in the advertisement part about cuisines, and target webpage captures
The residence time (the first data) of the click behavior and browsing of user B, and server is sent to by the first webpage.Server root
Behavior is hit at strong point and the residence time of browsing determines that user B is interested in cuisines, the relevant advertising information of generation cuisines,
The discount information etc. of the cuisines brand of user's concern, these information that server generates are sent to the first net as the second data
Page, the first webpage forward advertising information and discount information to target webpage.
Since the push of second data of the present embodiment is generated according to the first data, the first data can embody user
Interest and hobby, therefore, server can push in real time and accurately user needs information.
, can be in real time and accurately to user's advertisement for advertisement dispensing, advertisement at the time of is user
When with consumption propensity, therefore, the advertisement pushed in time can promote disappearing for user before the consumption impulsion of user disappears
Take.
In the present embodiment, long connect is established to the first Web page push message, the first webpage and server in real time in order to realize
It connects.Before introducing the long connection of the present embodiment, existing long connection is first introduced.Existing long connection mainly passes through the first net
Page sends a heartbeat packet to server at regular intervals and refreshes heart time.Long connection is kept to apply on webpage with app
Long connection the difference is that, when app is applied from a page jump to another page, do not need to disconnect webpage
Reconnection again, and need to disconnect the mistake of reconnection again when page end is from a page jump to another page by primary connection
Journey, this, which results in connecting in page jump duration, to continue.
In order to solve the problems, such as that the long connection of page end cannot continue, the present embodiment is in the long connection of creation, by target network
Page is nested in the iframe label of first page, establishes first page and the long of server connects, be nested in iframe label
In target webpage execute and jump in iframe label, what the first webpage outside iframe label and server were kept long connects
Connect can't jumping and disconnect because of iframe inside tags target webpage, to ensure that between the first webpage and server
The stability of long connection.
The iframe label being arranged in the present embodiment ensure that the duration and stability of long connection, be with duration connection
Full-duplex communication can realize long-time real-time Data Transmission, that is to say, that server can between the first webpage and server
The second data are pushed to the first page end with the first data captured in real time according to the first webpage.In addition, due to the first webpage
Capture is the mode of no intrusion, and the operation of user, which will not be captured, bothers, and will not reduce user experience.
The present embodiment is illustrated below in conjunction with Fig. 3.
301, user accesses game official website webpage by the first webpage of webpage running game.
302, when webpage is opened, webpage js and the foundation of official website server are connected using the long of full-duplex communication.
303, webpage js sends user related information.In some instances, the account information of collecting web page active user, use
The effective stay time etc. of the page address of family current browser and user on current page.
304, official website server sends user to recommendation server and draws a portrait in real time, and portrait is used to embody inhomogeneous people in real time
Group.In some specific examples, indicated by drawing a portrait in real time active user be to the interested crowd of current page or
To the uninterested crowd of current page.
305, user executes operation in the page.
306, webpage js captures the operation that user executes on webpage, and user's operation is sent to official website server.
307, the portrait information of official's server update user, and updated information is sent to recommendation server.
308, recommendation server carries out recommending analysis processing.In some embodiments, recommendation server judges that user is working as
Whether the effective stay time on the preceding page is greater than default effective stay time, if it is greater, then determining user to current page
It is interested.The content that analysis current page is shown is the skin or equipment information of some game role, it is determined that the user couple
The virtual objects have consumption propensity, then determine in the consumption propensity for determining user and need to believe to the first Web page push discount
Breath.
309, recommendation server is to official website server push discount information.
310, official website server pushes discount information to webpage js in real time.
311, discount information is shown to player in the first webpage.In this embodiment, server is pushed away to the first webpage in real time
It send, pushes the discount information of commodity to user in real time when determining that user has consumption propensity, improve the consumption wish of user.
Simultaneously as the discount information of push more meets the consumer psychology of user, the discount information that user sees is and goes for quotient
The relevant information of product, improves user experience.Also, during data collection and server push, the first net is not needed
Page sends request and receives response, does not influence user by the way of no intrusion in the viewing experience of the first webpage.
In some embodiments, above-mentioned the first webpage of game can be instant messaging webpage, such as wechat.It is browsed in user
When the circle of friends of wechat, phase is pushed in real time in the concern time of certain category information of circle of friends and click volume etc. for user according to user
Close news, the merchandise news etc. of classification.
In some embodiments, above-mentioned the first webpage of game can also be video web-pages.According to user to certain film
Viewing is the information that user pushes associated film in real time, or is in real time the member privilege information of user's pushing video webpage
Deng.
Optionally, the long connection in the present embodiment using full-duplex communication can be the long connection of websocket, should
Websocket is a kind of communication protocol, carries out full duplex after carrying out shaking hands between server and the first webpage by http
Communication.It, can be using the flash realization for supporting bottom-layer network function for not supporting the first webpage of websocket
The agreement of websocket carries out long connecting communication by the interface and server that call flash websocket to provide.Exist
The long connection of first webpage creation websocket or the interface for calling flash web socket to provide when opening target webpage
Executive chairman's connection.
That is the long connection of the first webpage creation includes: the first webpage load flash file, wherein flash file includes passing through
The execution logic of interface execution full duplex communication;The first webpage connects according to logic calling is executed after flash file interface statement
Mouthful;First webpage calling interface sends connection request to server;First webpage responds the company of connection request by interface
Connect response, wherein after the first webpage receives connection response, determine that the first webpage completes the connection of creation full duplex communication.
Flash file includes that the execution logic of full duplex communication is executed by interface, flash file interface statement, so that
First webpage can be attached with the interface of calling interface and server, realize full duplex communication.
Websocket, which opens the long timing connected and is illustrated, to be realized to flash below in conjunction with Fig. 4.
401, webpage loads swfobejct.js, to execute js logic.
402, flash file is called and loaded to js logic, runs websocket facade.
403, websocket facade registers the interface that js is called, i.e. interface statement, for webpage provide interface so as to
Server establishes connection.
404, websocket facade notifies js logic that initialization is completed, i.e. completion interface statement.
405, webpage loads web_socket.js logic, the interface that registration js is called.
406, page creation js node, i.e. webpage call flash in the interface of 403 statements.
407, websocket example is created, i.e. creation external interface logic.
408, raw websocket example is created, that is, creates internal api interface.
409, registered network event monitoring, the successful connection response sent with capture server.
411, socket connects.
412, bottom triggers successful connection event.The successful connection event that capture server returns.
413, websocket facade gives the successful connection event forwarding captured to js logic, completes full duplex connection
Realization.
It should be noted that the example page of Fig. 4 can be the above-mentioned first page for directly establishing long connection with server.
Full-duplex communication may be implemented again on the basis of establishing long connection, therefore, the first webpage calls the interface of flash file statement
Actively to the first data of server transport.First webpage can be in real time to the first data of server active transmission.
Optionally, the first webpage calls the interface server of flash file statement by the second of long connection push
Data.First webpage can also directly receive server active transmission in the case where not requesting the second data to server
Second data.
Optionally, after creating using the long connection of full duplex communication, the first webpage first calls flashws to close long connect
It connects, recalls raw ws and close long connection.
The long connection for being realized full duplex communication using flash is sent below in conjunction with Fig. 5, is received and closing is said
It is bright.
501, operation behavior (first data) of the user on the page is captured on the page, and the js for submitting to the page is patrolled
Volume.In some embodiments, the operation behavior of user includes clicking, browsing and stop operation etc..Specifically, user clicks the page
On picture, video or choose text etc.;Certain section of text, picture or the view that user shows on the page in browsing pages
It stays for some time when frequency.
502, the js logic of the page calls flash ws interface to send the operation row captured to websocket facade
For.
503, websocket facade calls raw ws to send operation behavior and realizes to websocket.
504, websocket, which is realized, calls network interface (in the 403 of Fig. 4 flash it is stated that interface) to server
Interface send operation behavioral data.In some embodiments, call it is stated that interface send the click of user and clear
Look at data etc..In some embodiments, the second data can be the discount information of commodity, the relevant news of user interest
With advertisement etc..
505, websocket capture server return the second data, by it is stated that interface server return
The second data returned.Websocket realizes the js logic that the second data are sent to the page by websocket facade, and
It shows on the page.
The above process is the first data of interface active transmission that the first webpage is stated by flash, and passes through flash sound
The second data that bright interface server is sent.The long connection of full duplex that the flash for terminating creation is realized is carried out below
Explanation.
506, the page sends the instruction closed to the js logic of the page.
507, js logic calls flash ws to close connection.
508, websocket facade calls raw ws to close connection.
509, websocket realizes that closing connection executes close event, and the information of connection closed is passed through websocket
Facade is sent to js logic, completes the closing of connection.
In above process, for supporting the first webpage of websocket that can execute the full duplex based on websocket
The long connection of communication, for not supporting the first webpage of websocket executes the long of the full duplex communication based on flash to connect.
Above-mentioned full duplex communication can be carried out data after completing shaking hands between the first webpage and server in connection
The process of transmission, data transmission makes requests without the first webpage or server.That is, server is not receiving
Data can be transmitted by long connect in the case where the request of one webpage;Feelings of first webpage in the request for not receiving server
Data can also be transmitted by long connect under condition, the first webpage can be connected while be sent and received by the length of full duplex communication
Data realize and carry out data transmission between the first webpage and server in real time.
Full duplex communication is realized by websocket and flash due to present embodiments providing, it can be for different the
One webpage uses different implementation methods, enhances the compatibility of the full duplex communication of the present embodiment.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of
Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because
According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know
It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules is not necessarily of the invention
It is necessary.
Through the above description of the embodiments, those skilled in the art can be understood that according to above-mentioned implementation
The method of example can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but it is very much
In the case of the former be more preferably embodiment.Based on this understanding, technical solution of the present invention is substantially in other words to existing
The part that technology contributes can be embodied in the form of software products, which is stored in a storage
In medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal device (can be mobile phone, calculate
Machine, server or network equipment etc.) execute method described in each embodiment of the present invention.
Embodiment 2
According to embodiments of the present invention, additionally provide it is a kind of for implementing the data transmission device of above-mentioned data transmission method,
The data transmission device is mainly used for executing data transmission method provided by above content of the embodiment of the present invention, below to this hair
Data transmission device provided by bright embodiment does specific introduction:
Fig. 6 is the schematic diagram of data transmission device according to an embodiment of the present invention, as shown in fig. 6, the data transmission device
It specifically includes that
Creating unit 60 is used to that the creation of js logic to be called to connect using the long of full duplex communication when opening target webpage,
In, target webpage is nested in the iframe label of the first webpage.
First transmission unit 62 is used for through long connection to the first data of server transport, and the first data are caught by target webpage
It catches to obtain.
Second transmission unit 64 is used to receive server by the second data of long connection push, and the second data are according to first
The first data that webpage reports generate, wherein before the first webpage receives the second data, the first webpage is not sent to server
For requesting the request of data of the second data.
Transmission unit 66 is used to send the second data to target webpage.
First webpage creates the long connection of full duplex communication, and full duplex communication may be implemented through the long connection of same simultaneously
To server reported data and the data from server are received, and long connection does not need the first webpage to server number of request
According to server can be after establishing long connection, actively to the first Web page push data.
In the present embodiment, the second data are generated according to the first data, therefore, to the second number of the first Web page push
According to being matched with the first data of the first collecting web page, the behavioural habits or interest preference at the current family of the first data volume
When, data needed for the second data of push can precisely match user, solving the prior art can not accurate propelling data
Technical problem.Further, it because being communicated between the first webpage and server by the long connection of full duplex communication, services
Device can obtain the first data that target webpage captures in real time, also can generate the second data according to the first data in real time,
And give the second data-pushing of generation to the first webpage in real time.During the second data of server push, is not needed
One webpage and target webpage are also achieved that server in real time to the first Web page push second number to server initiation request of data
According to having achieved the effect that real-time, accurate propelling data.
In some embodiments, when user A browsing objective webpage, " automobile " relevant information in target webpage is carried out
It clicks, stopped longer time in the advertisement part about automobile, target webpage captures the click behavior and browsing of user A
Residence time (the first data), and server is sent to by the first webpage.Server stops according to click behavior with what is browsed
The time is stayed to determine that user A is interested in automobile, the automobile brand that the relevant advertising information of generation automobile, user pay close attention to
Discount information etc., these information that server generates are sent to the first webpage as the second data, and the first webpage forwards advertisement letter
Breath and discount information are to target webpage.
In other embodiments, when user B browsing objective webpage, in target webpage in target webpage
" cuisines " relevant information click, has stopped longer time in the advertisement part about cuisines, and target webpage captures
The residence time (the first data) of the click behavior and browsing of user B, and server is sent to by the first webpage.Server root
Behavior is hit at strong point and the residence time of browsing determines that user B is interested in cuisines, the relevant advertising information of generation cuisines,
The discount information etc. of the cuisines brand of user's concern, these information that server generates are sent to the first net as the second data
Page, the first webpage forward advertising information and discount information to target webpage.
Since the push of second data of the present embodiment is generated according to the first data, the first data can embody user
Interest and hobby, therefore, server can push in real time and accurately user needs information.
, can be in real time and accurately to user's advertisement for advertisement dispensing, advertisement at the time of is user
When with consumption propensity, therefore, the advertisement pushed in time can promote disappearing for user before the consumption impulsion of user disappears
Take.
In the present embodiment, long connect is established to the first Web page push message, the first webpage and server in real time in order to realize
It connects.Before introducing the long connection of the present embodiment, existing long connection is first introduced.Existing long connection mainly passes through the first net
Page sends a heartbeat packet to server at regular intervals and refreshes heart time.Long connection is kept to apply on webpage with app
Long connection the difference is that, when app is applied from a page jump to another page, do not need to disconnect webpage
Reconnection again, and need to disconnect the mistake of reconnection again when page end is from a page jump to another page by primary connection
Journey, this, which results in connecting in page jump duration, to continue.
In order to solve the problems, such as that the long connection of page end cannot continue, the present embodiment is in the long connection of creation, by target network
Page is nested in the iframe label of first page, establishes first page and the long of server connects, be nested in iframe label
In target webpage execute and jump in iframe label, what the first webpage outside iframe label and server were kept long connects
Connect can't jumping and disconnect because of iframe inside tags target webpage, to ensure that between the first webpage and server
The stability of long connection.
The iframe label being arranged in the present embodiment ensure that the duration and stability of long connection, be with duration connection
Full-duplex communication can realize long-time real-time Data Transmission, that is to say, that server can between the first webpage and server
The second data are pushed to the first page end with the first data captured in real time according to the first webpage.In addition, due to the first webpage
Capture is the mode of no intrusion, and the operation of user, which will not be captured, bothers, and will not reduce user experience.
Optionally, creating unit includes: request module, for initiating handshake request to server by http agreement;Inspection
Module is surveyed, for handshake response transmitted by detection service device response handshake request;Creation module, for being detected in the first webpage
To after handshake response, long connection of the creation based on full-duplex communication.
In the full duplex communication for establishing websocket, it is only necessary to handshake request is initiated to server by http agreement,
Complete with after the shaking hands of server, it will be able to real-time perfoming duplex signaling.
Optionally, creating unit includes: loading module, for loading flash file, wherein flash file includes passing through
The execution logic of interface execution full duplex communication;First calling module, for being patrolled after flash file interface statement according to execution
Collect calling interface;Second calling module sends connection request to server for calling interface;Respond module, for by connecing
Mouth receives the connection response of response connection request, wherein after respond module receives connection response, determines that the first webpage is completed
Creation uses the connection of full duplex communication.
Optionally, the first transmission unit includes: third calling module, and the interface for calling flash file to state is actively
To the first data of server transport.
Optionally, the second transmission unit includes: the 4th calling module, the interface for calling flash file to state
The second data that server passes through long connection push.
Optionally, device further include: call unit, for calling the creation of js logic to connect using the long of full duplex communication
Later, the down interface of the long connection of the closing of flash is called, wherein close and grow in down interface intrinsic call bottom socket
Connection.
In some embodiments, above-mentioned the first webpage of game can be instant messaging webpage, such as wechat.It is browsed in user
When the circle of friends of wechat, phase is pushed in real time in the concern time of certain category information of circle of friends and click volume etc. for user according to user
Close news, the merchandise news etc. of classification.
In some embodiments, above-mentioned the first webpage of game can also be video web-pages.According to user to certain film
Viewing is the information that user pushes associated film in real time, or is in real time the member privilege information of user's pushing video webpage
Deng.
Embodiment 3
According to embodiments of the present invention, additionally provide it is a kind of for implementing the terminal of above-mentioned data transmission method, such as Fig. 7 institute
Show, which mainly includes that processor 701, camera 702, display 703, data-interface 704, memory 705 and network connect
Mouth 706, in which:
Camera 702 is mainly used for acquiring identity information and head image information of user etc..
The data that third party's tool obtains then mainly are transferred to processor in such a way that data are transmitted by data-interface 704
701。
Memory 705 is mainly used for the logic of webpage and the operation behavior data of user.
Network interface 706 is mainly used for carrying out network communication with server, provides support for data transmission.
Display 703 is mainly used for displaying target webpage and the second data.
Processor 701 is mainly used for performing the following operations:
When opening target webpage, the first webpage calls the creation of js logic using the long connection of full duplex communication, wherein mesh
Mark webpage is nested in the iframe label of the first webpage;First webpage is connected by long to the first data of server transport, the
One data are captured to obtain by target webpage;First webpage receives server and passes through the second data of long connection push, the second data
It is generated according to the first data that the first webpage reports, wherein before the first webpage receives the second data, the first webpage is not to clothes
Business device sends the request of data for requesting the second data;First webpage sends the second data to target webpage.
Processor 701 is also used to the first webpage and initiates handshake request to server by http agreement;The detection of first webpage
Server responds handshake response transmitted by handshake request;After the first webpage detects handshake response, creation is based on full duplex
The long connection of communication.
Processor 701 is also used to: the first webpage loads flash file, wherein flash file includes being executed by interface
The execution logic of full duplex communication;The first webpage is according to execution logic calling interface after flash file interface statement;First net
Page calling interface sends connection request to server;First webpage responds the connection response of connection request by interface,
In, after the first webpage receives connection response, determine that the first webpage completes the connection that creation uses full duplex communication.
Processor 701 is also used to: the first webpage calls the interface of flash file statement actively to the number of server transport first
According to.
Processor 701 is also used to: the first webpage calls the interface server of flash file statement to push away by long connection
The second data sent.
Processor 701 is also used to: the first webpage calls the down interface of the long connection of the closing of flash, wherein connects in closing
Mouth intrinsic call bottom socket closes long connection.
Processor 701 is also used to: the first webpage creates the long connection of the full duplex communication of websocket or calls
The interface that flash web socket is provided executes full duplex communication.
Optionally, the specific example in the present embodiment can be shown with reference to described in above-described embodiment 1 and embodiment 2
Example, details are not described herein for the present embodiment.
Embodiment 4
The embodiments of the present invention also provide a kind of storage mediums.Optionally, in the present embodiment, above-mentioned storage medium can
The program code of the data transmission method of the embodiment of the present invention for storage.
Optionally, in the present embodiment, above-mentioned storage medium can be located at mobile communications network, wide area network, Metropolitan Area Network (MAN) or
At least one network equipment in multiple network equipments in the network of local area network.
Optionally, in the present embodiment, storage medium is arranged to store the program code for executing following steps:
S1, when opening target webpage, the first webpage calls the creation of js logic using the long connection of full duplex communication;
S2, first webpage are connected by the length to the first data of server transport;
S3, first webpage receive the server and pass through the second data of the long connection push;
S4, first webpage send second data to the target webpage.
Optionally, in the present embodiment, above-mentioned storage medium can include but is not limited to: USB flash disk, read-only memory (ROM,
Read-Only Memory), random access memory (RAM, RandomAccess Memory), mobile hard disk, magnetic disk or light
The various media that can store program code such as disk.
Optionally, in the present embodiment, processor is executed according to program code stored in storage medium: the first webpage
Handshake request is initiated to server by http agreement;First webpage detection service device responds sound of shaking hands transmitted by handshake request
It answers;After the first webpage detects handshake response, long connection of the creation based on full-duplex communication.
Optionally, in the present embodiment, processor is executed according to program code stored in storage medium: the first webpage
Load flash file, wherein flash file includes that the execution logic of full duplex communication is executed by interface;In flash file
The first webpage is according to execution logic calling interface after interface statement;First webpage calling interface sends connection request to server;
First webpage responds the connection response of connection request by interface, wherein after the first webpage receives connection response, really
Fixed first webpage completes the connection that creation uses full duplex communication.
Optionally, in the present embodiment, processor is executed according to program code stored in storage medium: the first webpage
Call the interface of flash file statement actively to the first data of server transport.
Optionally, in the present embodiment, processor is executed according to program code stored in storage medium: the first webpage
The interface server of flash file statement is called to pass through the second data of long connection push.
Optionally, in the present embodiment, processor is executed according to program code stored in storage medium: the first webpage
Call the down interface of the long connection of the closing of flash, wherein close long connection in down interface intrinsic call bottom socket.
Optionally, the specific example in the present embodiment can be shown with reference to described in above-described embodiment 1 and embodiment 2
Example, details are not described herein for the present embodiment.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
If the integrated unit in above-described embodiment is realized in the form of SFU software functional unit and as independent product
When selling or using, it can store in above-mentioned computer-readable storage medium.Based on this understanding, skill of the invention
Substantially all or part of the part that contributes to existing technology or the technical solution can be with soft in other words for art scheme
The form of part product embodies, which is stored in a storage medium, including some instructions are used so that one
Platform or multiple stage computers equipment (can be personal computer, server or network equipment etc.) execute each embodiment institute of the present invention
State all or part of the steps of method.
In the above embodiment of the invention, it all emphasizes particularly on different fields to the description of each embodiment, does not have in some embodiment
The part of detailed description, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that the first disclosed webpage can pass through others
Mode is realized.Wherein, the apparatus embodiments described above are merely exemplary, such as the division of the unit, only
A kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or components can combine or
Person is desirably integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual
Between coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or communication link of unit or module
It connects, can be electrical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of software functional units.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art
For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered
It is considered as protection scope of the present invention.
Claims (11)
1. a kind of data transmission method characterized by comprising
First webpage calls the creation of js logic using the long connection of full duplex communication, wherein first webpage calls js logic
Creation includes: the first webpage load flash file using the long connection of full duplex communication, wherein the flash file packet
Include the execution logic that full duplex communication is executed by interface;First webpage after the flash file states the interface
The interface is called according to the execution logic;First webpage calls the interface to send connection request to server;Institute
State the connection response that the first webpage responds the connection request by the interface, wherein receive in first webpage
To after the connection response, determine that first webpage is completed to create the connection using full duplex communication;
First webpage is connected by the length to first data of server transport, wherein first data are by mesh
Mark webpage captures to obtain, and the target webpage is nested in the iframe label of first webpage;
First webpage receives the server by the second data of the long connection push, and second data are according to institute
It states first data that the first webpage reports to generate, wherein described before first webpage receives second data
First webpage does not send the request of data for requesting second data to the server, wherein first data are used
It is for matching with second data that first data match in the behavioural habits or interest preference that embody user
Data needed for user;
First webpage sends second data to the target webpage.
2. the method according to claim 1, wherein first webpage calls the creation of js logic to use full duplex
The length of communication, which connects, includes:
First webpage initiates handshake request to server by http agreement;
First webpage detects the server and responds handshake response transmitted by the handshake request;
After first webpage detects the handshake response, long connection of the creation based on the full-duplex communication.
3. being passed the method according to claim 1, wherein first webpage is connected by the length to server
Defeated first data include:
First webpage calls the interface of the flash file statement actively to the first number described in the server transport
According to.
4. the method according to claim 1, wherein first webpage, which receives the server, passes through the length
Connecting the second data pushed includes:
First webpage calls server described in the interface of the flash file statement to push away by the long connection
Second data sent.
5. the method according to claim 1, wherein calling the creation of js logic using complete double in first webpage
After the long connection of work communication, the method also includes:
First webpage calls the down interface of the closing of the flash long connection, wherein adjusts inside the down interface
The long connection is closed with bottom socket.
6. the method according to claim 1, wherein first webpage calls the creation of js logic to use full duplex
The length of communication, which connects, includes:
The long connection of the full duplex communication of the first webpage creation websocket calls flash web socket to provide
Interface execute full duplex communication.
7. a kind of data transmission device characterized by comprising
Creating unit, for calling the creation of js logic using the long connection of full duplex communication when opening target webpage, wherein institute
It states target webpage to be nested in the iframe label of the first webpage, the creating unit includes: loading module, for loading
Flash file, wherein the flash file includes that the execution logic of full duplex communication is executed by interface;First calls mould
Block, for calling the interface according to the execution logic after the flash file states the interface;Second calls mould
Block, for calling the interface to send connection request to server;Respond module, for by described in interface response
The connection response of connection request, wherein after the respond module receives the connection response, determine that first webpage is complete
At the creation connection using full duplex communication;
First transmission unit, for being connected by the length to first data of server transport, first data are by institute
Target webpage is stated to capture to obtain;
Second transmission unit passes through the second data of the long connection push, second data for receiving the server
First data reported according to first webpage generate, wherein first webpage receive second data it
Before, first webpage does not send the request of data for requesting second data to the server, wherein described first
Data are used to embody the behavioural habits or interest preference of user, and second data to match with first data are use
The data needed for matching user;
Transmission unit, for sending second data to the target webpage.
8. device according to claim 7, which is characterized in that the creating unit includes:
Request module, for initiating handshake request to server by http agreement;
Detection module responds handshake response transmitted by the handshake request for detecting the server;
Creation module, for creating based on the full-duplex communication after first webpage detects the handshake response
Long connection.
9. device according to claim 7, which is characterized in that first transmission unit includes:
Third calling module, for calling the interface of the flash file statement actively to described in the server transport
First data.
10. device according to claim 7, which is characterized in that second transmission unit includes:
4th calling module, for calling server described in the interface of the flash file statement to pass through the length
Connect second data of push.
11. device according to claim 10, which is characterized in that described device further include:
Call unit, for calling the closing institute of flash after calling the creation of js logic to connect using the length of full duplex communication
State the down interface of long connection, wherein close the long connection in the down interface intrinsic call bottom socket.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610555462.9A CN106209857B (en) | 2016-07-14 | 2016-07-14 | Data transmission method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610555462.9A CN106209857B (en) | 2016-07-14 | 2016-07-14 | Data transmission method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106209857A CN106209857A (en) | 2016-12-07 |
CN106209857B true CN106209857B (en) | 2019-04-12 |
Family
ID=57474831
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610555462.9A Active CN106209857B (en) | 2016-07-14 | 2016-07-14 | Data transmission method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106209857B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108572966A (en) * | 2017-03-09 | 2018-09-25 | 神州数码系统集成服务有限公司 | A kind of method and device creating personal portrait |
CN107241311A (en) * | 2017-05-15 | 2017-10-10 | 北京微影时代科技有限公司 | One kind selects seat method and device in real time |
CN107566346B (en) * | 2017-08-10 | 2020-08-11 | 腾讯科技(深圳)有限公司 | 3D game data transmission method and device, storage medium and electronic device |
CN108040099B (en) * | 2017-12-05 | 2021-02-26 | 北京安博通科技股份有限公司 | Advertisement page pushing method, device, equipment, client and system |
CN110430197A (en) * | 2019-08-08 | 2019-11-08 | 王小聪 | A kind of transaction data synchronization method of block chain network |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0275328A1 (en) * | 1986-08-01 | 1988-07-27 | Video Research Ltd | Apparatus for collecting tv channel data and market research data |
CN102571620A (en) * | 2010-12-14 | 2012-07-11 | 阿里巴巴集团控股有限公司 | Method and device for carrying out webpage communication, and webpage server |
CN103440259A (en) * | 2013-07-31 | 2013-12-11 | 亿赞普(北京)科技有限公司 | Network advertisement push method and device |
CN103997507A (en) * | 2013-02-20 | 2014-08-20 | 腾讯科技(深圳)有限公司 | Information push method and apparatus |
CN105279224A (en) * | 2015-09-09 | 2016-01-27 | 百度在线网络技术(北京)有限公司 | Information push method and device |
-
2016
- 2016-07-14 CN CN201610555462.9A patent/CN106209857B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0275328A1 (en) * | 1986-08-01 | 1988-07-27 | Video Research Ltd | Apparatus for collecting tv channel data and market research data |
CN102571620A (en) * | 2010-12-14 | 2012-07-11 | 阿里巴巴集团控股有限公司 | Method and device for carrying out webpage communication, and webpage server |
CN103997507A (en) * | 2013-02-20 | 2014-08-20 | 腾讯科技(深圳)有限公司 | Information push method and apparatus |
CN103440259A (en) * | 2013-07-31 | 2013-12-11 | 亿赞普(北京)科技有限公司 | Network advertisement push method and device |
CN105279224A (en) * | 2015-09-09 | 2016-01-27 | 百度在线网络技术(北京)有限公司 | Information push method and device |
Non-Patent Citations (3)
Title |
---|
"webrtc";张令考;《FreeSWITCH权威指南》;20141231;全文 |
"客户端javascript参考";弗兰纳根;《javascript权威指南(第6版)》;20121231;全文 |
"嵌入式框架标记";唐四薪;《基于web标准的网页设计与制作》;20151231;第73页 |
Also Published As
Publication number | Publication date |
---|---|
CN106209857A (en) | 2016-12-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106209857B (en) | Data transmission method and device | |
CN104216695B (en) | Page information to be showed is provided and shows the method and system of page info | |
US10298534B2 (en) | Associating an indication of user emotional reaction with content items presented by a social networking system | |
KR102066648B1 (en) | Advertisements in view | |
US20080288349A1 (en) | Methods and systems for online interactive communication | |
US20110251902A1 (en) | Target Area Based Content and Stream Monetization Using Feedback | |
US11687980B2 (en) | Method of operating a server and a user terminal for providing advertisement information, and apparatus thereof | |
CN109636488A (en) | Advertisement placement method and device | |
US9621622B2 (en) | Information providing apparatus, information providing method, and network system | |
US20160210662A1 (en) | Systems and Techniques for Configuring an Electronic Communication Based on Identified Preferred Channels of Sharing | |
US10528982B2 (en) | Determining a prompt for performing an action presented to a user in association with video data | |
US11455662B2 (en) | Optimizing generation of a feed of content for a user based on prior user interactions with the feed of content | |
CN109792557B (en) | Method for processing video data and storage medium | |
US20150294370A1 (en) | Target Area Based Monetization Using Sensory Feedback | |
CN107633426A (en) | Advertising message method for implantation and system based on environmental data | |
US10614484B2 (en) | Optimization of electronic media content item delivery based on past client interactions | |
US20180218399A1 (en) | Generating a content item for presentation to an online system user including content describing a product selected by the online system based on likelihoods of user interaction | |
CN105897900A (en) | Resource acquisition method and apparatus | |
US20170213245A1 (en) | Selecting content for online system users based on user interactions with third party applications | |
TW201142693A (en) | Object control method, object control program, and web server | |
CN107656935A (en) | Web page display method and apparatus | |
US9959258B2 (en) | Generating characteristics of users of an online system presented with content in a context relative to other content | |
CN109829293A (en) | Defend method and device, the system, storage medium, electronic device of browser | |
EP3901885A1 (en) | Providing an entity with an option to select an online system user to create content on behalf of the entity based on content associated with the entity previously created by the user | |
JP6347567B1 (en) | Information processing system, processing method, processing program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |