CN106209857A - Data transmission method and device - Google Patents
Data transmission method and device Download PDFInfo
- Publication number
- CN106209857A CN106209857A CN201610555462.9A CN201610555462A CN106209857A CN 106209857 A CN106209857 A CN 106209857A CN 201610555462 A CN201610555462 A CN 201610555462A CN 106209857 A CN106209857 A CN 106209857A
- 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.)
- Granted
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 device.Wherein, the method includes: the first webpage calls js logic and creates the long connection using full duplex communication;First webpage is connected to server transport the first data by long, and wherein, the first data are caught by target web and obtain, and target web is nested in the iframe label of the first webpage;First webpage receives server by long the second data connecting and pushing, the first data genaration that second data report according to the first webpage, wherein, before the first webpage receives the second data, the first webpage does not sends the request of data for request the second data to server;First webpage sends the second data to target web.The present invention solves cannot be in real time to the technical problem of the first Web page push message.
Description
Technical field
The present invention relates to field of data transmission, in particular to a kind of data transmission method and device.
Background technology
Prior art is when carrying out data transmission, and generally the active of employing server is to the mode of the first Web page push data,
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, but, the required propelling data obtained of each user is different, existing server without
Method is accurately to user's propelling data.
For above-mentioned problem, effective solution is the most not yet proposed.
Summary of the invention
Embodiments provide a kind of data transmission method and device, so that at least solve cannot propelling data accurately
Technical problem.
An aspect according to embodiments of the present invention, it is provided that a kind of data transmission method, including: opening target web
Time the first webpage call js logic and create the long connection using full duplex communication, wherein, described target web is nested in described the
In the iframe label of one webpage;Described first webpage long connects to server transport the first data by described, and described first
Data are caught by described target web and obtain;Described first webpage receives second that described server is pushed by described long connection
Data, described first data genaration that described second data report according to described first webpage, wherein, connect at described first webpage
Before receiving described second data, described first webpage does not sends for asking the data of described second data to be asked to described server
Ask;Described first webpage sends described second data to described target web.
Another aspect according to embodiments of the present invention, additionally provides a kind of data transmission device, including: creating unit, use
Using the long of full duplex communication to connect in calling the establishment of js logic when opening target web, wherein, described target web is nested
In the iframe label of the first webpage;First transmission unit, for being connected to server transport the first data by described length,
Described first data are caught by described target web and obtain;Second transmission unit, is used for receiving described server by described length
The second data that connection pushes, described first data genaration that described second data report according to described first webpage, wherein,
Described first webpage receives before described second data, and described first webpage does not sends to described server and is used for asking described the
The request of data of two data;Transmitting element, for sending described second data to described target web.
In embodiments of the present invention, the second data are according to the first data genaration, therefore, to the of the first Web page push
Two data are the first data match with the first collecting web page, embody behavioural habits or the interest of user in the first data
During preference, the second data of propelling movement can precisely mate the data needed for user, solves prior art and cannot precisely push number
According to technical problem.Further, because being communicated by the long connection of full duplex communication between the first webpage and server,
Server can obtain the first data that target web captures in real time, the most just can be in real time according to first data genaration the second number
According to, and give the first webpage by the second data-pushing of generation in real time.During server push the second data, it is not required to
First webpage and target web initiate request of data to server, are also achieved that server is in real time to the first Web page push second
Data, have reached the effect of propelling data real-time, accurate.
Accompanying drawing explanation
Accompanying drawing described herein is used for providing a further understanding of the present invention, constitutes the part of the application, this
Bright schematic description and description is used for explaining the present invention, is not intended that inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the schematic diagram of hardware configuration according to embodiments of the present invention;
Fig. 2 is the flow chart of data transmission method according to embodiments of the present invention;
Fig. 3 is the sequential chart setting up connection according to embodiments of the present invention;
Fig. 4 is that flash according to embodiments of the present invention realizes the long sequential chart connected of websocket unlatching;
Fig. 5 is that the long connection that employing flash realizes full duplex communication according to embodiments of the present invention is transmitted, receives
With the sequential chart closed;
Fig. 6 is the schematic diagram of data transmission device according to embodiments of the present invention;
Fig. 7 is the schematic diagram of terminal according to embodiments of the present invention.
Detailed description of the invention
In order to make those skilled in the art be more fully understood that the present invention program, below in conjunction with in the embodiment of the present invention
Accompanying drawing, is clearly and completely described the technical scheme in the embodiment of the present invention, it is clear that described embodiment is only
The embodiment of a present invention part rather than whole embodiments.Based on the embodiment in the present invention, ordinary skill people
The every other embodiment that member is obtained under not making creative work premise, all should belong to the model of present invention protection
Enclose.
It should be noted that term " first " in description and claims of this specification and above-mentioned accompanying drawing, "
Two " it is etc. for distinguishing similar object, without being used for describing specific order or precedence.Should be appreciated that so use
Data can exchange in the appropriate case, in order to embodiments of the invention described herein can with except here diagram or
Order beyond those described is implemented.Additionally, term " includes " and " having " and their any deformation, it is intended that cover
Cover non-exclusive comprising, such as, contain series of steps or the process of unit, method, system, product or equipment are not necessarily limited to
Those steps clearly listed or unit, but can include the most clearly listing or for these processes, method, product
Or intrinsic other step of equipment or unit.
Explanation of nouns:
Connect: the virtual communication circuit that in computer network, communication two party is set up.
Agreement: in computer network, communication two party is in the stylistic a kind of agreement of interactive mode and data.
Full duplex: in computer network, communication two party can carry out a kind of transmission mode of bidirectional data transfers simultaneously.
Real time propelling movement: a kind of transmission mode actively being sent data by server to the first webpage, is different from traditional the
The pattern of one web-page requests server response, it is not necessary to the request of the first webpage.
Http: HTML (Hypertext Markup Language), a kind of wide variety of communications protocol.
Websocket: a kind of agreement carrying out full duplex communication in single connection, can preferably save relative to Http
Server resource and bandwidth also reach real time propelling movement.
Long connection: short type of attachment normally used relative to Http, refers to that the first webpage and server keep one for a long time
Bar virtual communication circuit.
Js code: javascript script, it is provided that the basic function of data verification.Javascript makes webpage increase
Add interactive.
Iframe i.e. html tag, effect is the document in document, or the framework floated.Iframe element can create bag
Containing the inline frame of another one document, inner frame at once.
HTML: an i.e. application under HTML, standard generalized markup language.
Embodiment 1
According to embodiments of the present invention, it is provided that a kind of embodiment of the method that can be performed by the application device embodiment,
It should be noted that can be in the department of computer science of such as one group of computer executable instructions in the step shown in the flow chart of accompanying drawing
System performs, and, although show logical order in flow charts, but in some cases, can be to be different from herein
Order perform shown or described by step.
Alternatively, in the present embodiment, above-mentioned data transmission method can apply to terminal 102 kimonos as shown in Figure 1
In the hardware environment that business device 104 is constituted.As it is shown in figure 1, visitor's terminal 102 is attached with server 104 by network, above-mentioned
Network includes but not limited to: mobile communications network, wide area network, Metropolitan Area Network (MAN) or LAN, and terminal 102 can be mobile phone terminal, also
Can be PC terminal, notebook terminal or panel computer terminal.
The first webpage in terminal 102 is set up the long of full-duplex communication and is connected with server 104, is nested at target web
In first webpage, target web carries out webpage and redirects page and can redirect in the first webpage, and redirecting of target web can't
Affect the connection of the first webpage and server, it is achieved that target web is connected with the long of server.First webpage is connected by long
Being sent to server 104 by the first of target web seizure, the first webpage receives the second of server 104 transmission by long connection
Data, and the second data are sent to target web, owing to the second data are according to the first data genaration, therefore, the second number
According to can the interest of accurate match user and hobby, it is achieved thereby that precisely propelling data, solving prior art cannot be accurate
The technical problem of propelling data.
Present embodiments providing a kind of data transmission method, this data transmission method can be applied at the hardware shown in Fig. 1
In environment.
Fig. 2 is the flow chart of data transmission method according to embodiments of the present invention.As in figure 2 it is shown, this data transmission method
Comprise the steps:
Step S202, the first webpage calls js logic and creates the long connection using full duplex communication.
Step S204, the first webpage is connected to server transport the first data by long, and the first data are caught by the first webpage
Catching and obtain, target web is nested in the iframe label of the first webpage.
Step S206, the first webpage receives the second data that server is pushed by long connection, and the second data are according to first
The first data genaration that webpage reports, wherein, before the first webpage receives the second data, the first webpage does not sends to server
For asking the request of data of the second data.
Step S208, the first webpage sends the second data to target web.
First webpage creates the long connection of full duplex communication, and full duplex communication can realize being connected simultaneously by same length
To server reported data with receive from the data of server, and long connection need not the first webpage to server request number
According to, server can be after setting up long connection, actively to the first Web page push data.
In the present embodiment, the second data are according to the first data genaration, therefore, to the second number of the first Web page push
According to being the first data match with the first collecting web page, embody behavioural habits or the interest preference of user in the first data
Time, the second data of propelling movement can precisely mate the data needed for user, and solving prior art cannot accurate propelling data
Technical problem.Further, because being communicated by the long connection of full duplex communication between the first webpage and server, service
Device can obtain the first data that target web captures in real time, the most just can in real time according to first data genaration the second data,
And give the first webpage by the second data-pushing of generation in real time.During server push the second data, it is not required to
One webpage and target web initiate request of data to server, are also achieved that server is in real time to first Web page push the second number
According to, reach the effect of propelling data real-time, accurate.
In certain embodiments, during user's A browsing objective webpage, the information that " automobile " in target web is relevant is carried out
Clicking on, stopped the longer time at the advertisement part about automobile, target web catches the click behavior of user A and browses
The time of staying (the first data), and be sent to server by the first webpage.Server is according to click behavior and stopping of browsing
User A is interested in automobile to stay the time to determine, generates the automobile brand of the relevant advertising message of automobile, user's concern
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 web.
In other embodiment, during user's B browsing objective webpage, in target web in target web
The information that " cuisines " are relevant has carried out clicking on, having stopped the longer time at the advertisement part about cuisines, and target web catches
The click behavior of user B and the time of staying (the first data) browsed, and it is sent to server by the first webpage.Server root
Behavior is hit at strong point and the time of staying browsed determines that user B is interested in cuisines, generate the relevant advertising message of cuisines,
The discount information etc. of the cuisines brand that user pays close attention to, these information that server generates are sent to the first net as the second data
Page, the first webpage forwards advertising message and discount information to target web.
Owing to the propelling movement of second data of the present embodiment can embody user according to the first data genaration, the first data
Interest and hobby, therefore, server can push in real time and accurately user need information.
For advertisement putting, can be in real time and accurately to user's advertisement, the moment of advertisement is user
The when of having propensity to consume, therefore, the advertisement pushed in time can promote disappearing of user before the consumption impulsion of user disappears
Take.
In the present embodiment, in order to realize in real time to the first Web page push message, the first webpage and server set up long company
Connect.Before the long connection introducing the present embodiment, first introduce existing long connection.Existing long connection is mainly by the first net
Page sends a heartbeat packet at set intervals and refreshes heart time to server.Webpage keep long connection apply with app
Long connect different place and be, app applies when a page jump to the another one page, it is not necessary to disconnect webpage
Reconnect again, and page end needs through once connecting the mistake that disconnection reconnects again when a page jump to the another one page
Journey, this results in and connects can not continue at page jump duration.
Connecting, in order to solve the long of page end, the problem that can not continue, the present embodiment is when creating long connection, by target network
Page is nested in the iframe label of first page, sets up first page and is connected with the long of server, is nested in iframe label
In target web perform to redirect in iframe label, the first webpage outside iframe label and server keep long even
Connect and can't disconnect because of redirecting of iframe inside tags target web, thus ensure that between the first webpage and server
The long stability connected.
The iframe label arranged in the present embodiment ensure that persistence and the stability of long connection, with duration connection is
Full-duplex communication, can realize long-time real-time Data Transmission, say, that server can between the first webpage and server
The second data are pushed to the first page end with the first data caught according to the first webpage in real time.Further, since the first webpage
Seizure is that the operation of user will not be captured and bother, and will not reduce Consumer's Experience without the mode invaded.
Below in conjunction with Fig. 3, the present embodiment is illustrated.
301, user passes through webpage running game the first webpage, accesses game official website webpage.
302, when webpage is opened, webpage js uses the long of full-duplex communication to be connected with the foundation of official website server.
303, webpage js sends user related information.In some instances, the account information of collecting web page active user, use
The page address of family current browser and the user effective time of staying etc. on current page.
304, official website server is drawn a portrait in real time to recommendation server transmission user, and portrait is used for embodying inhomogeneous people in real time
Group.In some specific examples, by real time portrait represent active user be crowd interested in current page or
Crowd uninterested to current page.
305, user performs operation at the page.
306, webpage js catches the operation that user performs on webpage, and user operation is sent to official website server.
307, the portrait information of official's server update user, and will update after information be sent to recommendation server.
308, recommendation server carries out recommending analyzing and processing.In certain embodiments, it is recommended that server judges that user is working as
Whether the effective time of staying on the front page is more than is preset effective time of staying, if it is greater, then determine that user is to current page
Interested.The content analyzing current page displaying is skin or the equipment information of certain game role, it is determined that this user couple
This virtual objects has propensity to consume, then determine when determining the propensity to consume of user that needs are to the first Web page push discount letter
Breath.
309, recommendation server is to official website server push discount information.
310, official website server is to webpage js real time propelling movement discount information.
311, discount information is shown at the first webpage to player.In this embodiment, server pushes away to the first webpage in real time
Send, determining the discount information pushing commodity when user has propensity to consume in real time to user, improve the consumption wish of user.
Simultaneously as the discount information pushed more meets the consumer psychology of user, the discount information that user sees is and goes for business
The information that condition closes, improves Consumer's Experience.Further, during data collection and server push, it is not necessary to the first net
Page sends request and receives response, uses and does not affect user's viewing experience at the first webpage without the mode invaded.
In certain embodiments, above-mentioned game the first webpage can be instant messaging webpage, such as wechat etc..Browse user
During the circle of friends of wechat, push phase for user according to user in real time in concern time of certain category information of circle of friends and click volume etc.
Close the news of classification, merchandise news etc..
In certain embodiments, above-mentioned game the first webpage can also is that video web-pages.According to user to certain film
Viewing pushes the information of associated film in real time for user, or is the member privilege information of user's pushing video webpage in real time
Deng.
Alternatively, the long connection using full-duplex communication in the present embodiment can be that the long of websocket connects, should
Websocket is a kind of communication protocol, carries out full duplex after carry out shaking hands between server and the first webpage by http
Communication.For not supporting first webpage of websocket, the flash supporting bottom-layer network function can be used to realize
The agreement of websocket, the interface provided by calling flash websocket carries out long connecting communication with server.I.e. exist
When opening target web, the first webpage creates the long interface connected or call flash web socket offer of websocket
Executive chairman connects.
I.e. first webpage creates long connection and includes: the first webpage loads flash file, and wherein, flash file includes passing through
Interface performs the execution logic of full duplex communication;After flash file interface statement, the first webpage calls according to execution logic and connects
Mouthful;First webpage calling interface sends connection request to server;First webpage is by the company of interface response connection request
Connect response, wherein, after the first webpage receives connection response, determine that the first webpage completes to create the connection of full duplex communication.
Flash file includes the execution logic being performed full duplex communication by interface, flash file interface statement so that
First webpage can be attached with the interface of calling interface with server, it is achieved full duplex communication.
Below in conjunction with Fig. 4, flash is realized the long sequential connected of websocket unlatching to illustrate.
401, webpage loads swfobejct.js, to perform js logic.
402, flash file is called and loaded to js logic, runs websocket facade.
403, the websocket facade registration interface that calls of js, i.e. interface statement, provide interface for webpage so as with
Server is set up and is connected.
404, websocket facade notice js logic completes to initialize, i.e. completes interface statement.
405, webpage loads web_socket.js logic, the interface that registration js calls.
406, page creation js node, i.e. webpage call the flash interface in 403 statements.
407, create websocket example, i.e. create external interface logic.
408, create raw websocket example, i.e. create internal api interface.
409, registered network action listener, 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 is by the successful connection event forwarding that captures to js logic, completes full duplex and connects
Realization.
It should be noted that the example page of Fig. 4 can be above-mentioned directly foundation with server grows the first page being connected.
Can realize again full-duplex communication on the basis of setting up long connection, therefore, the first webpage calls the interface of flash file statement
Actively to server transport the first data.First webpage can be in real time to server active transmission the first data.
Alternatively, the first webpage calls the interface server of flash file statement by the second of long connection propelling movement
Data.First webpage is not in the case of server request the second data, it is also possible to directly receive what server actively sent
Second data.
Alternatively, after creating the long connection using full duplex communication, it is long even that the first webpage first calls flashws closedown
Connect, recall raw ws and close long connection.
It is transmitted below in conjunction with Fig. 5, receives and closedown is said using flash to realize the long connection of full duplex communication
Bright.
501, on the page, catch user's operation behavior (the first data) on the page, and the js submitting to the page patrols
Volume.In certain embodiments, the operation behavior of user includes clicking on, browsing and stop operation etc..Specifically, user clicks on the page
On picture, video or choose word etc.;User when browsing pages on the page show certain section of word, picture or regard
Frequently stay for some time time.
502, the js logic of the page is called flash ws interface and is sent the action row captured to websocket facade
For.
503, websocket facade calls raw ws and sends operation behavior to websocket realization.
504, websocket realizes calling network interface (in the 403 of Fig. 4 flash it is stated that interface) to server
Interface send operation behavioral data.In certain embodiments, call it is stated that interface send the click of user and clear
Look at data etc..In certain embodiments, the news that the second data can be the discount information of commodity, user interest is relevant
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 second data being sent to the js logic of the page by websocket facade, and
It is illustrated on the page.
Said process is that the first webpage actively sends the first data by the interface that flash states, and by flash sound
The second data that bright interface server sends.The full duplex length connection realized the flash terminating to create below is carried out
Explanation.
506, the page sends the instruction closed to the js logic of the page.
507, js logic is called flash ws and is closed connection.
508, websocket facade calls raw ws and closes connection.
509, websocket realizes closing connecting and performs close event, and the information of connection closed is passed through websocket
Facade is sent to js logic, completes the closedown connected.
In above process, for supporting that first webpage of websocket can perform full duplex based on websocket
The long connection of communication, for not supporting that first webpage of websocket performs the long connection of full duplex communication based on flash.
Above-mentioned full duplex communication can be carried out data after completing shaking hands between the first webpage and server when connecting
Transmission, the process of data transmission makes requests on without the first webpage or server.It is to say, server is not receiving
Transmission data can be connected by long in the case of the request of one webpage;First webpage is in the feelings of the request not receiving server
Can also connect transmission data by long under condition, the first webpage can be by sending and receive simultaneously long connection of full duplex communication
Data, it is achieved that carry out data transmission between the first webpage and server in real time.
Full duplex communication is realized by websocket and flash owing to present embodiments providing, can be for different
One webpage uses different implementation methods, enhances the compatibility of the full duplex communication of the present embodiment.
It should be noted that for aforesaid each method embodiment, in order to be briefly described, therefore it is all expressed as a series of
Combination of actions, but those skilled in the art should know, the present invention is not limited by described sequence of movement because
According to the present invention, some step can use other orders or carry out simultaneously.Secondly, those skilled in the art also should know
Knowing, embodiment described in this description belongs to preferred embodiment, involved action and the module not necessarily present invention
Necessary.
Through the above description of the embodiments, those skilled in the art is it can be understood that arrive according to above-mentioned enforcement
The method of example can add the mode of required general hardware platform by software and realize, naturally it is also possible to by hardware, but a lot
In the case of the former is more preferably embodiment.Based on such understanding, technical scheme is the most in other words to existing
The part that technology contributes can embody with the form of software product, and this computer software product is stored in a storage
In medium (such as ROM/RAM, magnetic disc, CD), including some instructions with so that a station terminal equipment (can be mobile phone, calculate
Machine, server, or the network equipment etc.) perform the method described in each embodiment of the present invention.
Embodiment 2
According to embodiments of the present invention, additionally provide a kind of data transmission device for implementing above-mentioned data transmission method,
This data transmission device is mainly used in performing the data transmission method that embodiment of the present invention foregoing is provided, below to this
The data transmission device that bright embodiment is provided does specifically to be introduced:
Fig. 6 is the schematic diagram of data transmission device according to embodiments of the present invention, as shown in Figure 6, and this data transmission device
Specifically include that
Creating unit 60 creates the long connection of employing full duplex communication for calling js logic when opening target web, its
In, target web is nested in the iframe label of the first webpage.
First transmission unit 62 is for connecting to server transport the first data by long, and the first data are caught by target web
Catch and obtain.
Second transmission unit 64 is for receiving the second data that server is pushed by long connection, and the second data are according to first
The first data genaration that webpage reports, wherein, before the first webpage receives the second data, the first webpage does not sends to server
For asking the request of data of the second data.
Transmitting element 66 is for sending the second data to target web.
First webpage creates the long connection of full duplex communication, and full duplex communication can realize being connected simultaneously by same length
To server reported data with receive from the data of server, and long connection need not the first webpage to server request number
According to, server can be after setting up long connection, actively to the first Web page push data.
In the present embodiment, the second data are according to the first data genaration, therefore, to the second number of the first Web page push
According to being the first data match with the first collecting web page, embody behavioural habits or the interest preference of user in the first data
Time, the second data of propelling movement can precisely mate the data needed for user, and solving prior art cannot accurate propelling data
Technical problem.Further, because being communicated by the long connection of full duplex communication between the first webpage and server, service
Device can obtain the first data that target web captures in real time, the most just can in real time according to first data genaration the second data,
And give the first webpage by the second data-pushing of generation in real time.During server push the second data, it is not required to
One webpage and target web initiate request of data to server, are also achieved that server is in real time to first Web page push the second number
According to, reach the effect of propelling data real-time, accurate.
In certain embodiments, during user's A browsing objective webpage, the information that " automobile " in target web is relevant is carried out
Clicking on, stopped the longer time at the advertisement part about automobile, target web catches the click behavior of user A and browses
The time of staying (the first data), and be sent to server by the first webpage.Server is according to click behavior and stopping of browsing
User A is interested in automobile to stay the time to determine, generates the automobile brand of the relevant advertising message of automobile, user's concern
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 web.
In other embodiment, during user's B browsing objective webpage, in target web in target web
The information that " cuisines " are relevant has carried out clicking on, having stopped the longer time at the advertisement part about cuisines, and target web catches
The click behavior of user B and the time of staying (the first data) browsed, and it is sent to server by the first webpage.Server root
Behavior is hit at strong point and the time of staying browsed determines that user B is interested in cuisines, generate the relevant advertising message of cuisines,
The discount information etc. of the cuisines brand that user pays close attention to, these information that server generates are sent to the first net as the second data
Page, the first webpage forwards advertising message and discount information to target web.
Owing to the propelling movement of second data of the present embodiment can embody user according to the first data genaration, the first data
Interest and hobby, therefore, server can push in real time and accurately user need information.
For advertisement putting, can be in real time and accurately to user's advertisement, the moment of advertisement is user
The when of having propensity to consume, therefore, the advertisement pushed in time can promote disappearing of user before the consumption impulsion of user disappears
Take.
In the present embodiment, in order to realize in real time to the first Web page push message, the first webpage and server set up long company
Connect.Before the long connection introducing the present embodiment, first introduce existing long connection.Existing long connection is mainly by the first net
Page sends a heartbeat packet at set intervals and refreshes heart time to server.Webpage keep long connection apply with app
Long connect different place and be, app applies when a page jump to the another one page, it is not necessary to disconnect webpage
Reconnect again, and page end needs through once connecting the mistake that disconnection reconnects again when a page jump to the another one page
Journey, this results in and connects can not continue at page jump duration.
Connecting, in order to solve the long of page end, the problem that can not continue, the present embodiment is when creating long connection, by target network
Page is nested in the iframe label of first page, sets up first page and is connected with the long of server, is nested in iframe label
In target web perform to redirect in iframe label, the first webpage outside iframe label and server keep long even
Connect and can't disconnect because of redirecting of iframe inside tags target web, thus ensure that between the first webpage and server
The long stability connected.
The iframe label arranged in the present embodiment ensure that persistence and the stability of long connection, with duration connection is
Full-duplex communication, can realize long-time real-time Data Transmission, say, that server can between the first webpage and server
The second data are pushed to the first page end with the first data caught according to the first webpage in real time.Further, since the first webpage
Seizure is that the operation of user will not be captured and bother, and will not reduce Consumer's Experience without the mode invaded.
Alternatively, creating unit includes: request module, for initiating handshake request by http agreement to server;Inspection
Survey module, for detecting the handshake response that server response handshake request is sent;Creation module, for detecting at the first webpage
After handshake response, create long connection based on full-duplex communication.
When setting up the full duplex communication of websocket, it is only necessary to initiate handshake request by http agreement to server,
Complete with the shaking hands of server after, it becomes possible to carry out duplex signaling in real time.
Alternatively, creating unit includes: load-on module, is used for loading flash file, and wherein, flash file includes passing through
Interface performs the execution logic of full duplex communication;First calling module, for patrolling according to execution after flash file interface statement
Collect calling interface;Second calling module, sends connection request for calling interface to server;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 completes
Create the connection using full duplex communication.
Alternatively, the first transmission unit includes: the 3rd calling module, for calling the interface of flash file statement actively
To server transport the first data.
Alternatively, the second transmission unit includes: the 4th calling module, for calling the interface of flash file statement
Server is by long the second data connecting and pushing.
Alternatively, device also includes: call unit, in the long connection calling js logic establishment employing full duplex communication
Afterwards, call the long down interface connected of closing of flash, wherein, close at down interface intrinsic call bottom socket long
Connect.
In certain embodiments, above-mentioned game the first webpage can be instant messaging webpage, such as wechat etc..Browse user
During the circle of friends of wechat, push phase for user according to user in real time in concern time of certain category information of circle of friends and click volume etc.
Close the news of classification, merchandise news etc..
In certain embodiments, above-mentioned game the first webpage can also is that video web-pages.According to user to certain film
Viewing pushes the information of associated film in real time for user, or is the member privilege information of user's pushing video webpage in real time
Deng.
Embodiment 3
According to embodiments of the present invention, additionally provide a kind of terminal for implementing above-mentioned data transmission method, such as Fig. 7 institute
Showing, this terminal mainly includes that processor 701, photographic head 702, display 703, data-interface 704, memorizer 705 and network connect
Mouth 706, wherein:
Photographic head 702 is mainly used in gathering identity information and the head image information etc. of user.
Data-interface 704 is then main is transferred to processor by the data that third party's instrument obtains by the way of data are transmitted
701。
Memorizer 705 is mainly used in the logic of webpage and the operation behavior data of user.
Network interface 706 is mainly used in carrying out network service with server, provides for data transmission and supports.
Display 703 is mainly used in showing target web and the second data.
Processor 701 is mainly used in performing to operate as follows:
When opening target web, the first webpage calls js logic and creates the long connection using full duplex communication, wherein, mesh
Mark webpage is nested in the iframe label of the first webpage;First webpage is connected to server transport the first data by long, the
One data are caught by target web and obtain;First webpage receives server by long the second data connecting and pushing, the second data
The first data genaration reported according to the first webpage, wherein, before the first webpage receives the second data, the first webpage is not to clothes
Business device sends the request of data for request the second data;First webpage sends the second data to target web.
Processor 701 is additionally operable to the first webpage and initiates handshake request by http agreement to server;First webpage detection
The handshake response that server response handshake request is sent;After the first webpage detects handshake response, create based on full duplex
The long connection of communication.
Processor 701 is additionally operable to: the first webpage loads flash file, and wherein, flash file includes being performed by interface
The execution logic of full duplex communication;After flash file interface statement, the first webpage is according to performing logic calling interface;First net
Page calling interface sends connection request to server;First webpage responds the connection response of connection request by interface, its
In, after the first webpage receives connection response, determine that the first webpage completes to create the connection using full duplex communication.
Processor 701 is additionally operable to: the first webpage calls the interface of flash file statement actively to server transport the first number
According to.
Processor 701 is additionally operable to: the first webpage is called the interface server of flash file statement and pushed away by long connection
The second data sent.
Processor 701 is additionally operable to: the first webpage calls the down interface closing long connection of flash, wherein, connects in closedown
Mouth intrinsic call bottom socket closes long connection.
Processor 701 is additionally operable to: the first webpage creates the long of the full duplex communication of websocket and connects or call
The interface that flash web socket provides performs full duplex communication.
Alternatively, the concrete example in the present embodiment is referred to showing described in above-described embodiment 1 and embodiment 2
Example, the present embodiment does not repeats them here.
Embodiment 4
Embodiments of the invention additionally provide a kind of storage medium.Alternatively, in the present embodiment, above-mentioned storage medium can
Program code for the data transmission method of the storage embodiment of the present invention.
Alternatively, in the present embodiment, above-mentioned storage medium may 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 LAN.
Alternatively, in the present embodiment, storage medium is arranged to storage for the program code performing following steps:
S1, when opening target web, the first webpage calls js logic and creates the long connection using full duplex communication;
S2, described first webpage is connected to server transport the first data by described length;
S3, described first webpage receives described server by described long the second data connecting propelling movement;
S4, described first webpage sends described second data to described target web.
Alternatively, in the present embodiment, above-mentioned storage medium can include but not limited to: USB flash disk, read only memory (ROM,
Read-Only Memory), random access memory (RAM, RandomAccess Memory), portable hard drive, magnetic disc or light
The various medium that can store program code such as dish.
Alternatively, in the present embodiment, processor performs according to the program code stored in storage medium: the first webpage
Handshake request is initiated to server by http agreement;The sound of shaking hands that first webpage detection server response handshake request is sent
Should;After the first webpage detects handshake response, create long connection based on full-duplex communication.
Alternatively, in the present embodiment, processor performs according to the program code stored in storage medium: the first webpage
Loading flash file, wherein, flash file includes the execution logic being performed full duplex communication by interface;In flash file
After interface statement, the first webpage is according to performing logic calling interface;First webpage calling interface sends connection request to server;
First webpage is by the connection response of interface response connection request, wherein, after the first webpage receives connection response, really
Fixed first webpage completes to create the connection using full duplex communication.
Alternatively, in the present embodiment, processor performs according to the program code stored in storage medium: the first webpage
Call the interface of flash file statement actively to server transport the first data.
Alternatively, in the present embodiment, processor performs according to the program code stored in storage medium: the first webpage
Call the interface server of flash file statement by long the second data connecting and pushing.
Alternatively, in the present embodiment, processor performs according to the program code stored in storage medium: the first webpage
Call the long down interface connected of closing of flash, wherein, close long connection at down interface intrinsic call bottom socket.
Alternatively, the concrete example in the present embodiment is referred to showing described in above-described embodiment 1 and embodiment 2
Example, the present embodiment does not repeats them here.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
If the integrated unit in above-described embodiment realizes and as independent product using the form of SFU software functional unit
When selling or use, can be stored in the storage medium that above computer can read.Based on such understanding, the skill of the present invention
Part that prior art is contributed by art scheme the most in other words or this technical scheme completely or partially can be with soft
The form of part product embodies, and this computer software product is stored in storage medium, including some instructions with so that one
Platform or multiple stage computer equipment (can be for personal computer, server or the network equipment etc.) perform each embodiment institute of the present invention
State all or part of step of method.
In the above embodiment of the present invention, the description to each embodiment all emphasizes particularly on different fields, and does not has in certain embodiment
The part described in detail, may refer to the associated description of other embodiments.
In several embodiments provided herein, it should be understood that the first disclosed webpage, can be passed through other
Mode realizes.Wherein, device embodiment described above is only schematically, and the division of the most described unit is only
A kind of logic function divides, actual can have when realizing other dividing mode, the most multiple unit or assembly can in conjunction with or
Person is desirably integrated into another system, or some features can be ignored, or does not performs.Another point, shown or discussed is mutual
Between coupling direct-coupling or communication connection can be the INDIRECT COUPLING by some interfaces, unit or module or communication link
Connect, can be being electrical or other form.
The described unit illustrated as separating component can be or may not be physically separate, shows as unit
The parts shown can be or may not be physical location, i.e. may be located at a place, or can also be distributed to multiple
On NE.Some or all of unit therein can be selected according to the actual needs to realize the mesh of the present embodiment scheme
's.
It addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it is also possible to
It is that unit is individually physically present, it is also possible to two or more unit are integrated in a unit.Above-mentioned integrated list
Unit both can realize to use the form of hardware, it would however also be possible to employ the form of SFU software functional unit realizes.
The above is only the preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art
For Yuan, under the premise without departing from the principles of the invention, it is also possible to make some improvements and modifications, these improvements and modifications also should
It is considered as protection scope of the present invention.
Claims (13)
1. a data transmission method, it is characterised in that including:
First webpage calls js logic and creates the long connection using full duplex communication;
Described first webpage is by described long connection to server transport the first data, and wherein, described first data are by target network
Page catches and obtains, and described target web is nested in the iframe label of described first webpage;
Described first webpage receives the second data that described server is pushed by described long connection, and described second data are according to institute
State described first data genaration that the first webpage reports, wherein, before described first webpage receives described second data, described
First webpage does not sends the request of data for asking described second data to described server;
Described first webpage sends described second data to described target web.
Method the most according to claim 1, it is characterised in that described first webpage calls js logic and creates employing full duplex
The long connection of communication includes:
Described first webpage initiates handshake request by http agreement to server;
Described first webpage detects described server and responds the handshake response that described handshake request is sent;
After described first webpage detects described handshake response, create long connection based on described full-duplex communication.
Method the most according to claim 1, it is characterised in that described first webpage calls js logic and creates employing full duplex
The long connection of communication includes:
Described first webpage loads flash file, and wherein, described flash file includes performing full duplex communication by interface
Perform logic;
After described flash file states described interface, described first webpage calls described interface according to described execution logic;
Described first webpage calls described interface and sends connection request to described server;
Described first webpage responds the connection response of described connection request by described interface, wherein, at described first net
After page receives described connection response, determine that described first webpage completes to create the connection of described employing full duplex communication.
Method the most according to claim 3, it is characterised in that described first webpage was passed to server by described long connection
Defeated first data include:
Described first webpage calls the described interface of described flash file statement actively to the first number described in described server transport
According to.
Method the most according to claim 3, it is characterised in that described first webpage receives described server by described length
Connect the second data pushed to include:
Described first webpage is called server described in the described interface that described flash file is stated and is pushed away by described long connection
Described second data sent.
Method the most according to claim 1, it is characterised in that call js logic at described first webpage and create complete pair of employing
After the long connection of work communication, described method also includes:
Described first webpage calls the down interface closing described long connection of flash, wherein, adjusts inside described down interface
Described long connection is closed with bottom socket.
Method the most according to claim 1, it is characterised in that described first webpage calls js logic and creates employing full duplex
The long connection of communication includes:
Described first webpage creates the long of the full duplex communication of websocket and connects or call flash web socket offer
Interface perform full duplex communication.
8. a data transmission device, it is characterised in that including:
Creating unit, creates the long connection of employing full duplex communication, wherein, institute for calling js logic when opening target web
State target web to be nested in the iframe label of the first webpage;
First transmission unit, for being connected to server transport the first data by described length, described first data are by described mesh
Mark webpage catches and obtains;
Second transmission unit, for receiving described server by described long the second data connecting propelling movement, described second data
Described first data genaration reported according to described first webpage, wherein, described first webpage receive described second data it
Before, described first webpage does not sends the request of data for asking described second data to described server;
Transmitting element, for sending described second data to described target web.
Device the most according to claim 8, it is characterised in that described creating unit includes:
Request module, for initiating handshake request by http agreement to server;
Detection module, responds, for detecting described server, the handshake response that described handshake request is sent;
Creation module, for after described first webpage detects described handshake response, creates based on described full-duplex communication
Long connection.
Device the most according to claim 8, it is characterised in that described creating unit includes:
Load-on module, is used for loading flash file, and wherein, described flash file includes performing full duplex communication by interface
Perform logic;
First calling module, for described flash file state after described interface according to described execution logic call described in connect
Mouthful;
Second calling module, is used for calling described interface and sends connection request to described server;
Respond module, for responding the connection response of described connection request, wherein, at described response mould by described interface
After block receives described connection response, determine that described first webpage completes to create the connection of described employing full duplex communication.
11. devices according to claim 10, it is characterised in that described first transmission unit includes:
3rd calling module, for calling the described interface of described flash file statement actively to described in described server transport
First data.
12. devices according to claim 10, it is characterised in that described second transmission unit includes:
4th calling module, for calling server described in the described interface that described flash file is stated by described length
Connect described second data pushed.
13. devices according to claim 12, it is characterised in that described device also includes:
Call unit, for, after calling the long connection of js logic establishment employing full duplex communication, calling the closedown institute of flash
State the down interface of long connection, wherein, close described long connection at described 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 true CN106209857A (en) | 2016-12-07 |
CN106209857B 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) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107241311A (en) * | 2017-05-15 | 2017-10-10 | 北京微影时代科技有限公司 | One kind selects seat method and device in real time |
CN107566346A (en) * | 2017-08-10 | 2018-01-09 | 腾讯科技(深圳)有限公司 | Transmission method, device and the storage medium of 3D game datas, electronic installation |
CN108040099A (en) * | 2017-12-05 | 2018-05-15 | 北京安博通科技股份有限公司 | Advertisement page method for pushing, device, equipment, client and system |
CN108572966A (en) * | 2017-03-09 | 2018-09-25 | 神州数码系统集成服务有限公司 | A kind of method and device creating personal portrait |
CN110430197A (en) * | 2019-08-08 | 2019-11-08 | 王小聪 | A kind of transaction data synchronization method of block chain network |
CN113918855A (en) * | 2021-09-26 | 2022-01-11 | 用友网络科技股份有限公司 | Data synchronization method, electronic device and readable storage medium for multi-terminal applications |
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 (4)
Title |
---|
DONGDONGLENG: ""长连接"方式实现服务器推送", 《CSDN博客》 * |
唐四薪: ""嵌入式框架标记"", 《基于WEB标准的网页设计与制作》 * |
弗兰纳根: ""客户端javascript参考"", 《JAVASCRIPT权威指南(第6版)》 * |
张令考: ""webrtc"", 《FREESWITCH权威指南》 * |
Cited By (8)
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 |
CN107566346A (en) * | 2017-08-10 | 2018-01-09 | 腾讯科技(深圳)有限公司 | Transmission method, device and the storage medium of 3D game datas, electronic installation |
CN107566346B (en) * | 2017-08-10 | 2020-08-11 | 腾讯科技(深圳)有限公司 | 3D game data transmission method and device, storage medium and electronic device |
CN108040099A (en) * | 2017-12-05 | 2018-05-15 | 北京安博通科技股份有限公司 | Advertisement page method for pushing, device, equipment, client and system |
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 |
CN113918855A (en) * | 2021-09-26 | 2022-01-11 | 用友网络科技股份有限公司 | Data synchronization method, electronic device and readable storage medium for multi-terminal applications |
Also Published As
Publication number | Publication date |
---|---|
CN106209857B (en) | 2019-04-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106209857B (en) | Data transmission method and device | |
US12210856B2 (en) | Dynamic code management | |
CN103064863B (en) | A kind of method and apparatus that recommendation information is provided | |
US10298534B2 (en) | Associating an indication of user emotional reaction with content items presented by a social networking system | |
JP5702374B2 (en) | Collecting information about connections in social networking services | |
US20080288349A1 (en) | Methods and systems for online interactive communication | |
US10489822B2 (en) | Extending audience reach in messaging campaigns using probabilistic ID linking | |
US10230672B2 (en) | Inserting a search box into a mobile terminal dialog messaging protocol | |
US9621622B2 (en) | Information providing apparatus, information providing method, and network system | |
JP2013530436A (en) | Social graph including web pages outside the social networking system | |
US20140089397A1 (en) | Method, server, and client for pushing and displaying splash screen | |
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 | |
CN104363261B (en) | Information-pushing method, device and server | |
CN105897900A (en) | Resource acquisition method and apparatus | |
US20180336587A1 (en) | Optimization of electronic media content item delivery based on past client interactions | |
US20170213245A1 (en) | Selecting content for online system users based on user interactions with third party applications | |
CN108205555A (en) | Information recommendation method, device, browser and terminal device | |
KR20060005153A (en) | Real-time online personalized information system and method through customer priority analysis | |
WO2015127291A1 (en) | System and method for controlled syndication and population of database information | |
US10685378B2 (en) | Generating product catalogs using tracking pixels | |
KR101394330B1 (en) | System for advertisement service display sequential two pop-up window, and method of the same | |
CN107656935A (en) | Web page display method and apparatus | |
US20170046740A1 (en) | Methods and systems relating to click-through advertising | |
US10491652B2 (en) | Providing a content item from an online system to a third party system that modifies the content item for presentation in accordance with a layout specified by the third party system |
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 |