The method and system of client and webpage end transmission data
Technical field
The present invention relates to the communications field, relate in particular to the method and system of a kind of client and webpage end transmission data.
Background technology
Web game has just constantly been groped middle development since releasing, various new technologies also constantly incorporate.The particularly realization of the data interchange technology of client and webpage end makes the network game industry scintillating.This interworking technology has been broken the fixed pattern that web game exploitation is in the past only played at the webpage end, makes web game that the lifting of matter all arranged on technology, the fine arts, the recreation quality, has overcome the restriction of current browser technology to greatest extent.
The data sync of client and webpage end is embodied on the data interchange of client and webpage, make and to carry out intercommunication between user by the login of the Web page and the user by the client login, be in webpage end or the client resulting data of playing no matter reached, can remain on the other end.The technology of present client and web data intercommunication is mainly passed through the data center of server device, the data of client or webpage are transmitted to the opposite end realizes, concrete, when client sends data to the webpage end, client sends this data center with data earlier, and by this data center these data is sent to the webpage end; Same, when the webpage end sent data to client, the webpage end sent the data to this data center earlier, sends the data to client by this data center again.
State in realization in the process of data sync of client and webpage end, the inventor finds that there are the following problems at least in the prior art: realize the mutual of client and webpage end data, must data be transmitted and could realize by data center, thereby the mutual a large amount of bandwidth of use that needs of the client of making and webpage end, and, when the user is many, need to increase more server and support the mutual of client and webpage end data, make that the cost of realizing client and webpage end transmission data is higher, and the communication burden is heavier.
Summary of the invention
Embodiments of the invention provide the method and system of a kind of client and webpage end transmission data, have reduced cost and the communication burden of client and webpage end transmission data.
For achieving the above object, embodiments of the invention adopt following technical scheme:
The method of a kind of client and webpage end transmission data comprises:
The webpage termination is received data, carries out the event of described data correspondence, and call that client provides carry out first interface of transfer of data with described webpage end, send described data to described client;
Described client receives described data, and described data is handled after knowing that described webpage end calls described first interface, carries out the event of described data correspondence.
The system of a kind of client and webpage end transmission data comprises: webpage end and client;
Described webpage end be used for to receive data, carries out the event of described data correspondence, and call that described client provides carry out first interface of transfer of data with described webpage end, send described data to described client;
Described client is used for receiving described data, and described data being handled after knowing that described webpage end calls described first interface, carries out the event of described data correspondence.
The method and system of the client that the embodiment of the invention provides and webpage end transmission data, with transmit data by data center in the prior art and could realize that transfer of data between the two compares, it can be after the webpage termination be received data, by first interface that carries out transfer of data with described webpage end that provides with client these data are sent to client, the data that make the webpage end send to client do not need through the forwarding of data center and directly transmission, make the mutual needed bandwidth of client and webpage end reduce, and then when the user is many, do not need to increase more server and support the mutual of client and webpage end data, thereby the cost and the communication that have reduced client and webpage end transmission data are born.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art, to do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below, apparently, accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the method flow diagram of a kind of client and webpage end transmission data in the embodiment of the invention 1;
Fig. 2 shows the design sketch that receives the corresponding event of data simultaneously for client in the embodiment of the invention 1 and webpage end;
Fig. 3 is the method flow diagram of another kind of client and webpage end transmission data in the embodiment of the invention 1;
Fig. 4 is the method flow diagram of another kind of client and webpage end transmission data in the embodiment of the invention 1;
Fig. 5 stops to carry out the design sketch that receives the corresponding event of data simultaneously for client in the embodiment of the invention 1 and webpage end;
Fig. 6 is the block diagram of system of client and webpage end transmission data in the embodiment of the invention 2.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
Embodiment 1
The embodiment of the invention provides the method for a kind of client and webpage end transmission data, and as shown in Figure 1, this method comprises:
101, the webpage termination is received data, carries out the event of described data correspondence, and call that client provides carry out first interface of transfer of data with described webpage end, send described data to described client.
Wherein, first interface that carries out transfer of data with the webpage end that described client provides can be physical interface; also can be software interface; the concrete embodiment of the invention does not limit this; as long as it can realize the interface of the transfer of data of webpage end and client, all belong to the scope of embodiment of the invention protection.When it is software interface, for example, when the script of described client Web exploitation is that (JavaScript, it is a kind of based on object and event-driven and have the client script language of relative safety to JS.Simultaneously also be a kind of script that is widely used in client Web exploitation) time, described first interface that calls is for revising the location attribute of client; When the script of client Web exploitation was other language, it can be the attribute with corresponding function, and the embodiment of the invention does not limit this.
102, described client receives described data, and described data is handled after knowing that described webpage end calls described first interface, carries out the event of described data correspondence.
Based on the method for above-mentioned client and webpage end transmission data, be for user's experience: the webpage end shows the corresponding event of data that receives simultaneously with client.For example, as shown in Figure 2, when QQ user receives message, the prompting that all can initiate a message simultaneously of webpage end and client.Wherein, when the user receives good friend's "~evil U.S. " the message of sending, prompting message 1 is the icon of "~evil beautiful " among my good friend and the information indicating icon on the good friend left side that prompting message 2 is me, and prompting message 3 is the application program in the client task hurdle (the lower left corner circle of Fig. 2 is schemed), and prompting simultaneously all can initiate a message.Wherein, the prompting message of the icon of "~evil U.S. " among my good friend and the information indicating icon on my good friend left side is the prompting message of webpage end, and the prompting message in the client task hurdle is the prompting message of client.
After webpage end and client were all carried out the event of described data correspondence, the user both can carry out operation response to described event at the webpage end, also can carry out operation response to described event in client, and the concrete embodiment of the invention does not limit this; Though but at any end described event is carried out operation response, the other end all can be carried out this operation response.Concrete,
When client receives when receiving the response of the corresponding event of data, the embodiment of the invention also provides following client and webpage end to transmit the method for data, and as shown in Figure 3, this method comprises:
201, described client stops the execution of described event after the response that receives described event, and call that described webpage end provides carry out second interface of transfer of data with described client, send the response of described event to described webpage end.
Need to prove, after the event of the described data correspondence of client executing, this event can be shown to the user, after the user sees this event, can carry out a response to this event, namely this event is had the operation of a client, client can stop the execution of this event after the response that receives described event; And in order to make the webpage end know that the client user is to the response of this event, also stop the execution of this event of webpage end, what client can call that described webpage end provides carries out second interface of transfer of data with described client, sends the response of described event to described webpage end.
202, after described webpage termination is received the response of described event, stop carrying out described event.
Receive that when the webpage termination when receiving the response of the corresponding event of data, the embodiment of the invention also provides following client and webpage end to transmit the method for data, as shown in Figure 4, this method comprises:
301, described webpage end stops the execution of described event after the response that receives described event, and sends the response of described event to described client by described first interface.
302, after described client receives the response of described event, stop carrying out described event.
Method based on above-mentioned client and webpage end transmission data, be for user's experience: after webpage end and client show the corresponding event of reception data simultaneously, no matter the user carries out operation response at the webpage end or in client to described event, the other end also can be carried out this operation response.For example, as shown in Figure 5, after QQ user receives message, and webpage end and client all can initiate a message simultaneously and remind; The user clicks this prompting message 3 in client, and the prompting message of client disappears, and the prompting message 1 and 2 of webpage end also disappears simultaneously, and all returns to and can receive the good friend and do not send message state before.
The embodiment of the invention, with transmit data by data center in the prior art and could realize that transfer of data between the two compares, it can be after the webpage termination be received data, by first interface that carries out transfer of data with described webpage end that provides with client these data are sent to client, the data that make the webpage end send to client do not need through the forwarding of data center and directly transmission, make the mutual needed bandwidth of client and webpage end reduce, and then when the user is many, do not need to increase more server and support the mutual of client and webpage end data, thereby the cost and the communication that have reduced client and webpage end transmission data are born.
And, in the embodiment of the invention, when client is transmitted data to the webpage end, second interface that carries out transfer of data with described client that client also can provide by the webpage end transfers data to the webpage end, the data that make client send to the webpage end do not need through the forwarding of data center and directly transmission, make the mutual needed bandwidth of client and webpage end further reduce, when the user is many, more do not need to increase more server and support data interaction between client and the webpage end, thereby further reduced cost and the communication burden of client and webpage end transmission data.
Embodiment 2
The embodiment of the invention provides the system of a kind of client and webpage end transmission data, and as shown in Figure 6, this system comprises: webpage end 41 and client 42.
Described webpage end 41 is used for receiving data, carries out the event of described data correspondence, and first interface that described client 42 webpage ends 41 that provide and described carry out transfer of data is provided, and sends described data to described client 42.Wherein, first interface that carries out transfer of data with the webpage end that described client provides can be physical interface; also can be software interface; the concrete embodiment of the invention does not limit this; as long as it can realize the interface of the transfer of data of webpage end and client, all belong to the scope of embodiment of the invention protection.When it is software interface, for example, when the script of described client Web exploitation is that (JavaScript, it is a kind of based on object and event-driven and have the client script language of relative safety to JS.Simultaneously also be a kind of script that is widely used in client Web exploitation) time, described first interface that calls is for revising the location attribute of client; When the script of client Web exploitation was other language, it can be the attribute with corresponding function, and the embodiment of the invention does not limit this.
Described client 42 is used for receiving described data, and described data being handled after knowing that described webpage end 41 calls described first interface, carries out the event of described data correspondence.
Further alternative, after webpage end and client are all carried out the event of described data correspondence, the user both can carry out operation response to described event at the webpage end, also can carry out operation response to described event in client, and the concrete embodiment of the invention does not limit this; Though but at any end described event is carried out operation response, the other end all can be carried out this operation response.
When client 42 receives when receiving the response of the corresponding event of data, described client 42 also is used for, after the response that receives described event, stop the execution of described event, and second interface that described webpage end 41 clients 42 that provide and described are carried out transfer of data is provided, send the response of described event to described webpage end 41; Described webpage end 41 also is used for, receive the response of described event after, stop to carry out described event.
When webpage end 41 receives when receiving the response of the corresponding event of data, described webpage end 41 also is used for, after the response that receives described event, stop the execution of described event, and send the response of described event by described first interface to described client 42; Described client 42 also is used for, receive the response of described event after, stop to carry out described event.
Need to prove, the related client of system of client and webpage end transmission data and other descriptions of webpage end are provided in the embodiment of the invention, the associated description in can reference example 1, the embodiment of the invention will repeat no more herein.
The embodiment of the invention, with transmit data by data center in the prior art and could realize that transfer of data between the two compares, it can be after the webpage termination be received data, by first interface that carries out transfer of data with described webpage end that provides with client these data are sent to client, the data that make the webpage end send to client do not need through the forwarding of data center and directly transmission, make the mutual needed bandwidth of client and webpage end reduce, and then when the user is many, do not need to increase more server and support the mutual of client and webpage end data, thereby the cost and the communication that have reduced client and webpage end transmission data are born.
And, in the embodiment of the invention, when client is transmitted data to the webpage end, second interface that carries out transfer of data with described client that client also can provide by the webpage end transfers data to the webpage end, the data that make client send to the webpage end do not need through the forwarding of data center and directly transmission, make the mutual needed bandwidth of client and webpage end further reduce, when the user is many, more do not need to increase more server and support data interaction between client and the webpage end, thereby further reduced cost and the communication burden of client and webpage end transmission data.
Through the above description of the embodiments, the those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential common hardware, can certainly pass through hardware, but the former is better execution mode under a lot of situation.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product is stored in the storage medium that can read, floppy disk as computer, hard disk or CD etc., comprise some instructions with so that computer equipment (can be personal computer, server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
The above; only be the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of described claim.