CN108111634A - A kind of instant data transmission method and system based on websocket protocol Yu http agreements - Google Patents

A kind of instant data transmission method and system based on websocket protocol Yu http agreements Download PDF

Info

Publication number
CN108111634A
CN108111634A CN201810166029.5A CN201810166029A CN108111634A CN 108111634 A CN108111634 A CN 108111634A CN 201810166029 A CN201810166029 A CN 201810166029A CN 108111634 A CN108111634 A CN 108111634A
Authority
CN
China
Prior art keywords
data
websocket
html5
user
module
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
Application number
CN201810166029.5A
Other languages
Chinese (zh)
Other versions
CN108111634B (en
Inventor
李�杰
何隽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Bodian Zhihe Technology Co ltd
Original Assignee
Beijing Focus Shinkansen Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Focus Shinkansen Information Technology Co Ltd filed Critical Beijing Focus Shinkansen Information Technology Co Ltd
Priority to CN201810166029.5A priority Critical patent/CN108111634B/en
Publication of CN108111634A publication Critical patent/CN108111634A/en
Application granted granted Critical
Publication of CN108111634B publication Critical patent/CN108111634B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

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

Abstract

The present invention provides a kind of instant data transmission method grade system based on websocket protocol Yu http agreements, method includes:Establish the connection between html5 and the websocket server of front end, based on websocket server push websocket data to front end html5 user, front end html5 uses event trigger mechanism, processing is filtered to repeating websocket data, the data after filtering are shown to user, new websocket data whether are received in front end html5 detection preset times, if, then receive new websocket data, if it is not, then:Whether correct http request verification data set is performed, if so, data are transmitted using websocket protocol, if it is not, then:It performs http agreements and obtains data;Judge whether verification terminates, terminate data if so, performing http request and calling.It is inconsistent that the present invention can not only solve message front and back end in instant data transmission, but also solves the problems, such as that resource overhead waste, output propagation delay time are longer.

Description

A kind of instant data transmission method based on websocket protocol and http agreements and System
Technical field
The invention belongs to timely data communication technology fields more particularly to a kind of websocket protocol that is based on to assist with http The instant data transmission method and system of view.
Background technology
Existing instant data communication mainly transmits data or separately through http separately through websocket protocol Agreement poll transmits message, and therefore, when websocket protocol is used alone, websocket is during connection is established Message is can not receive, causes message front and back end inconsistent, there are serious defect problem, and in the situation that http polls are used alone Under, not only waste of resource expense, but also data propagation delay time is longer.
Therefore, it is inconsistent that message front and back end how had not only been solved in instant data transmission, but also has solved resource overhead and wastes, is defeated It is longer to go out the propagation delay time, is a urgent problem to be solved.
The content of the invention
In view of this, the present invention provides a kind of instant transmission side datas based on websocket protocol Yu http agreements Method, it is inconsistent not only to have solved message front and back end in instant data transmission, but also solves resource overhead waste, output transmission delay The problem of time is longer.
To achieve these goals, the present invention provides following technical solution:
A kind of instant data transmission method based on websocket protocol Yu http agreements, including:
Establish the connection between html5 and the websocket server of front end;
Based on the websocket server push websocket data to the front end html5 user;
The front end html5 uses event trigger mechanism, is filtered processing to repeating websocket data, will filter Data afterwards are shown to the user;
New websocket data whether are received in the front end html5 detections preset time, if so, receiving institute New websocket data are stated, if it is not, then:
Whether correct perform http request verification data set, if so, data are transmitted using websocket protocol, if It is no, then:
It performs http agreements and obtains data;
Judge whether verification terminates, terminate data if so, performing http request and calling.
Preferably, it is described to be used based on the websocket server push websocket data to the front end html5 Family includes:
The websocket data are packaged into json data by the websocket servers;
Based on websocket protocol or http agreements by the json data transmissions to the front end html5 user.
Preferably, the front end html5 uses event trigger mechanism, and processing is filtered to repeating websocket data, Data after filtering are shown to the user includes:
The front end html5 caches duplicate removal mode according to the key-value form trigger events of json using data acquisition system Processing is filtered to repeating websocket data, the data after filtering are shown to the user.
Preferably, after the execution http request calls end data, further include:
Based on the websocket server push global message data to the front end html5 user.
Preferably, the preset time is 1.5 seconds.
A kind of instant data transmission system based on websocket protocol Yu http agreements, including:
Module is established, for establishing the connection between html5 and the websocket server of front end;
Pushing module, for being based on the websocket server push websocket data to the front end html5 User;
Data processing module, for the front end html5 using event trigger mechanism, to repeat websocket data into Data after filtering are shown to the user by row filtration treatment;
Detection module, for whether receiving new websocket data in front end html5 detection preset times;
Receiving module, for when the front end html5 detection preset time in receive new websocket data when, Receive the new websocket data;
Correction verification module does not receive new websocket data for working as in the front end html5 detections preset time When, whether correct perform http request verification data set;
Transport module, for when execution http request verification data set is correct, being transmitted using websocket agreements Data;
Acquisition module, for when execution http request verification data set is incorrect, performing http agreements and obtaining data;
Judgment module, for judging whether verification terminates;
Calling module terminates data at the end of verification is judged, performing http request and calling.
Preferably, the pushing module is specifically used for:
The websocket data are packaged into json data by the websocket servers;
Based on websocket protocol or http agreements by the json data transmissions to the front end html5 user.
Preferably, the data processing module is specifically used for:
The front end html5 caches duplicate removal mode according to the key-value form trigger events of json using data acquisition system Processing is filtered to repeating websocket data, the data after filtering are shown to the user.
Preferably, the pushing module is additionally operable to:
Based on the websocket server push global message data to the front end html5 user.
Preferably, the preset time is 1.5 seconds.
It can be seen from the above technical proposal that the present invention provides a kind of based on websocket protocol and http agreements Instant data transmission method when needing to carry out instant data transmission, initially sets up front end html5 and websocket servers Between connection, be then based on websocket server push websocket data to front end html5 user, front end html5 Using event trigger mechanism, processing is filtered to repeating websocket data, the data after filtering are shown to user, it is preceding New websocket data whether are received in the html5 detection preset times of end, if so, receiving new websocket numbers According to if it is not, then:
Whether correct perform http request verification data set, if so, data are transmitted using websocket protocol, if It is no, then:It performs http agreements and obtains data;Judge whether verification terminates, terminate data if so, performing http request and calling. Using http agreements and and websocket protocol, rationally using websocket protocol progress message sink, then utilize http Agreement carries out data check and the message lost carries out data correction, solves the problems, such as that data front and back end is inconsistent.
Description of the drawings
It in order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention, for those of ordinary skill in the art, without creative efforts, can be with Other attached drawings are obtained according to these attached drawings.
Fig. 1 is that a kind of instant data transmission method based on websocket protocol and http agreements disclosed by the invention is real Apply the method flow diagram of example 1;
Fig. 2 is that a kind of instant data transmission method based on websocket protocol and http agreements disclosed by the invention is real Apply the method flow diagram of example 2;
Fig. 3 is that a kind of instant data transmission system based on websocket protocol and http agreements disclosed by the invention is real Apply the structure diagram of example 1;
Fig. 4 is that a kind of instant data transmission system based on websocket protocol and http agreements disclosed by the invention is real Apply the structure diagram of example 2.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other without making creative work Embodiment belongs to the scope of protection of the invention.
As shown in Figure 1, it is a kind of instant data transmission based on websocket protocol Yu http agreements disclosed by the invention The flow chart of embodiment of the method 1, the described method includes:
S101, connection between html5 and the websocket server of front end is established;
When needing to carry out instant data transmission, front end html5 first is established with websocket servers and connected.
S102, based on websocket server push websocket data to front end html5 user;
After connection is established between html5 and the websocket server of front end, websocket server push Websocket data are to front end html5 user.Websocket server transmission datas use simplex mode, websocket clothes Being engaged in, only responsible transmission data, not responsible verification data, front end html5 are called device by way of xhr using http agreements Websocket server interfaces carry out the acquisition of data check and http data.
S103, front end html5 use event trigger mechanism, are filtered processing to repeating websocket data, will filter Data afterwards are shown to user;
After when front end, html5 gets the websocket data of websocket server push, front end html5 is used Event trigger mechanism, while processing is filtered to repetition message, data after display filtering to user, front end html5 with After websocket servers establish connection, when front end html5 receives message, the api in websocket servers can be adjusted With then front end html5 can carry out duplicate removal to message.
New websocket data whether are received in S104, front end html5 detection preset time, if so then execute S105, if it is not, then performing S106:
Meanwhile front end html5 can repeat to detect whether to receive new websocket data in preset time.
S105, new websocket data are received;
When receiving new websocket data in front end html5 detection preset times, then receive newly Websocket data.
Whether S106, execution http request verification data set are correct, if so then execute S107, if it is not, then performing S108:
When not receiving new websocket data in front end html5 detection preset times, websocket servers A http request can be sent, and carries front end html5 parts latest data and is compared, websocket servers can compare Whether data are latest data, return to a whether correct response.
S107, data are transmitted using websocket protocol;
When execution http request verification data set is correct, websocket protocol transmission data are continuing with.
S108, http agreements acquisition data are performed;
When execution http request verification data set is incorrect, starts http agreements and obtain data.
S109, judge whether verification terminates, if so, performing S110:
S110, perform http request and call and terminate data.
At the end of verification, perform http request and call and terminate data, front end html5 calls websocket using ajax Server interface, this method are based on http agreements.
In conclusion in the above-described embodiments, when needing to carry out instant data transmission, initially set up front end html5 with Connection between websocket servers is then based on websocket server push websocket data to front end Html5 user, front end html5 use event trigger mechanism, processing are filtered to repeating websocket data, after filtering Data be shown to user, new websocket data whether are received in front end html5 detection preset times, if so, connecing By new websocket data, if it is not, then:Whether correct http request verification data set is performed, if so, using Websocket agreements transmit data, if it is not, then:It performs http agreements and obtains data;Judge whether verification terminates, if so, It performs http request and calls and terminate data.Using http agreements and and websocket protocol, rationally utilize websocket protocol Message sink is carried out, then data check is carried out using http agreements and the message lost carries out data correction, solve data The problem of front and back end is inconsistent.
As shown in Fig. 2, it is a kind of instant data transmission based on websocket protocol Yu http agreements disclosed by the invention The flow chart of embodiment of the method 2, the described method includes:
S201, connection between html5 and the websocket server of front end is established;
When needing to carry out instant data transmission, front end html5 first is established with websocket servers and connected.
S202, based on websocket server push websocket data to front end html5 user;
After connection is established between html5 and the websocket server of front end, websocket server push Websocket data are to front end html5 user.Websocket server transmission datas use simplex mode, websocket clothes Being engaged in, only responsible transmission data, not responsible verification data, front end html5 are called device by way of xhr using http agreements Websocket server interfaces carry out the acquisition of data check and http data.
S203, front end html5 use event trigger mechanism, are filtered processing to repeating websocket data, will filter Data afterwards are shown to the user;
After when front end, html5 gets the websocket data of websocket server push, front end html5 is used Event trigger mechanism, while processing is filtered to repetition message, data after display filtering to user, front end html5 with After websocket servers establish connection, when front end html5 receives message, the api in websocket servers can be adjusted With then front end html5 can carry out duplicate removal to message.
New websocket data whether are received in S204, front end html5 detection preset time, if so then execute S205, if it is not, then performing S206:
Meanwhile front end html5 can repeat to detect whether to receive new websocket data in preset time.
S205, new websocket data are received;
When receiving new websocket data in front end html5 detection preset times, then receive newly Websocket data.
Whether S206, execution http request verification data set are correct, if so then execute S207, if it is not, then performing S208:
When not receiving new websocket data in front end html5 detection preset times, websocket servers A http request can be sent, and carries front end html5 parts latest data and is compared, websocket servers can compare Whether data are latest data, return to a whether correct response.
S207, data are transmitted using websocket protocol;
When execution http request verification data set is correct, websocket protocol transmission data are continuing with.
S208, http agreements acquisition data are performed;
When execution http request verification data set is incorrect, starts http agreements and obtain data.
S209, judge whether verification terminates, if so, performing S210:
S210, perform http request and call and terminate data;
At the end of verification, perform http request and call and terminate data, front end html5 calls websocket using ajax Server interface, this method are based on http agreements.
S211, based on websocket server push global message data to the front end html5 user.
Front end html5 user when quickly receiving the message of websocket servers, exist do not received when establishing part disappear The situation of breath asks a global message data, using repeated duplicate removal principle without making when calling and terminating data Into Data duplication, therefore, correct situation is verified back in the case that partial data is unreceived.
In conclusion in the above-described embodiments, when needing to carry out instant data transmission, initially set up front end html5 with Connection between websocket servers is then based on websocket server push websocket data to front end Html5 user, front end html5 use event trigger mechanism, processing are filtered to repeating websocket data, after filtering Data be shown to user, new websocket data whether are received in front end html5 detection preset times, if so, connecing By new websocket data, if it is not, then:Whether correct http request verification data set is performed, if so, using Websocket agreements transmit data, if it is not, then:It performs http agreements and obtains data;Judge whether verification terminates, if so, It performs http request and calls and terminate data, used based on websocket server push global message data to the front end html5 Family.Using http agreements and and websocket protocol, rationally using websocket agreements progress message sink, then utilize Http agreements carry out data check and the message lost carries out data correction, solve the problems, such as that data front and back end is inconsistent.And A global message data are asked when calling and terminating data, using repeated duplicate removal principle without causing data weight It is multiple, therefore, correct situation is verified back in the case that partial data is unreceived.
Specifically, in the above-described embodiments, based on websocket server push websocket data to front end html5 Can be that websocket servers seal data into json data, then pass through websocket protocol or http during user Agreement is transferred to front end html5, after front end html5 receives data, advanced row data deduplication processing, then using the tactile of event Hair mechanism according to the key-value form trigger events of json, then generates different effects and is presented to user.
Specifically, in the above-described embodiments, front end html5 uses event trigger mechanism, to repeating websocket data Processing is filtered, the data after filtering are shown to user to be, front end html5 receives the duplicate removal mechanism after data, Front end html5 caches De-weight method using data acquisition system, first stores the data transmitted into map objects, then basis Be packaged into a singleton pattern, the first step first to event handling when by singleton pattern obtain whether the data in map objects deposit Duplicate removal processing is being carried out, is being repeated data if data are had found, second step duplicate removal is regular using dom trees duplicate removal, according to The effect that event trigger mechanism generates, then judges whether the triggering event.
Specifically, in the above-described embodiments, preset time can be 1.5 seconds.
As shown in figure 3, it is a kind of instant data transmission based on websocket protocol Yu http agreements disclosed by the invention The structure diagram of system embodiment 1, the system comprises:
Module 301 is established, for establishing the connection between html5 and the websocket server of front end;
When needing to carry out instant data transmission, front end html5 first is established with websocket servers and connected.
Pushing module 302, for being based on websocket server push websocket data to front end html5 user;
After connection is established between html5 and the websocket server of front end, websocket server push Websocket data are to front end html5 user.Websocket server transmission datas use simplex mode, websocket clothes Being engaged in, only responsible transmission data, not responsible verification data, front end html5 are called device by way of xhr using http agreements Websocket server interfaces carry out the acquisition of data check and http data.
Data processing module 303, for front end html5 using event trigger mechanism, to repeat websocket data into Data after filtering are shown to the user by row filtration treatment;
After when front end, html5 gets the websocket data of websocket server push, front end html5 is used Event trigger mechanism, while processing is filtered to repetition message, data after display filtering to user, front end html5 with After websocket servers establish connection, when front end html5 receives message, the api in websocket servers can be adjusted With then front end html5 can carry out duplicate removal to message.
Detection module 304, for whether receiving new websocket data in front end html5 detection preset times;
Meanwhile front end html5 can repeat to detect whether to receive new websocket data in preset time.
Receiving module 305 receives new websocket data for working as in the front end html5 detections preset time When, receive new websocket data;
When receiving new websocket data in front end html5 detection preset times, then receive newly Websocket data.
Correction verification module 306 does not receive new websocket numbers for working as in the front end html5 detections preset time According to when, perform http request verification data set it is whether correct;
When not receiving new websocket data in front end html5 detection preset times, websocket servers A http request can be sent, and carries front end html5 parts latest data and is compared, websocket servers can compare Whether data are latest data, return to a whether correct response.
Transport module 307, for when execution http request verification data set is correct, being passed using websocket agreements Transmission of data;
When execution http request verification data set is correct, websocket protocol transmission data are continuing with.
Acquisition module 308, for when execution http request verification data set is incorrect, performing http agreements and obtaining Data;
When execution http request verification data set is incorrect, starts http agreements and obtain data.
Judgment module 309, for judging whether verification terminates;
Calling module 310 terminates data at the end of verification is judged, performing http request and calling.
At the end of verification, perform http request and call and terminate data, front end html5 calls websocket using ajax Server interface, this method are based on http agreements.
In conclusion in the above-described embodiments, when needing to carry out instant data transmission, initially set up front end html5 with Connection between websocket servers is then based on websocket server push websocket data to front end Html5 user, front end html5 use event trigger mechanism, processing are filtered to repeating websocket data, after filtering Data be shown to user, new websocket data whether are received in front end html5 detection preset times, if so, connecing By new websocket data, if it is not, then:Whether correct http request verification data set is performed, if so, using Websocket agreements transmit data, if it is not, then:It performs http agreements and obtains data;Judge whether verification terminates, if so, It performs http request and calls and terminate data.Using http agreements and and websocket protocol, rationally utilize websocket protocol Message sink is carried out, then data check is carried out using http agreements and the message lost carries out data correction, solve data The problem of front and back end is inconsistent.
As shown in figure 4, it is a kind of instant data transmission based on websocket protocol Yu http agreements disclosed by the invention The structure diagram of system embodiment 2, the system comprises:
Module 401 is established, for establishing the connection between html5 and the websocket server of front end;
When needing to carry out instant data transmission, front end html5 first is established with websocket servers and connected.
Pushing module 402, for being based on websocket server push websocket data to front end html5 user;
After connection is established between html5 and the websocket server of front end, websocket server push Websocket data are to front end html5 user.Websocket server transmission datas use simplex mode, websocket clothes Being engaged in, only responsible transmission data, not responsible verification data, front end html5 are called device by way of xhr using http agreements Websocket server interfaces carry out the acquisition of data check and http data.
Data processing module 403, for front end html5 using event trigger mechanism, to repeat websocket data into Data after filtering are shown to the user by row filtration treatment;
After when front end, html5 gets the websocket data of websocket server push, front end html5 is used Event trigger mechanism, while processing is filtered to repetition message, data after display filtering to user, front end html5 with After websocket servers establish connection, when front end html5 receives message, the api in websocket servers can be adjusted With then front end html5 can carry out duplicate removal to message.
Detection module 404, for whether receiving new websocket data in front end html5 detection preset times;
Meanwhile front end html5 can repeat to detect whether to receive new websocket data in preset time.
Receiving module 405 receives new websocket data for working as in the front end html5 detections preset time When, receive new websocket data;
When receiving new websocket data in front end html5 detection preset times, then receive newly Websocket data.
Correction verification module 406 does not receive new websocket numbers for working as in the front end html5 detections preset time According to when, perform http request verification data set it is whether correct;
When not receiving new websocket data in front end html5 detection preset times, websocket servers A http request can be sent, and carries front end html5 parts latest data and is compared, websocket servers can compare Whether data are latest data, return to a whether correct response.
Transport module 407, for when execution http request verification data set is correct, being passed using websocket agreements Transmission of data;
When execution http request verification data set is correct, websocket protocol transmission data are continuing with.
Acquisition module 408, for when execution http request verification data set is incorrect, performing http agreements and obtaining Data;
When execution http request verification data set is incorrect, starts http agreements and obtain data.
Judgment module 409, for judging whether verification terminates;
Calling module 410 terminates data at the end of verification is judged, performing http request and calling.
At the end of verification, perform http request and call and terminate data, front end html5 calls websocket using ajax Server interface, this method are based on http agreements.
Pushing module 402 is additionally operable to based on websocket server push global message data to the front end html5 User.
Front end html5 user when quickly receiving the message of websocket servers, exist do not received when establishing part disappear The situation of breath asks a global message data, using repeated duplicate removal principle without making when calling and terminating data Into Data duplication, therefore, correct situation is verified back in the case that partial data is unreceived.
In conclusion in the above-described embodiments, when needing to carry out instant data transmission, initially set up front end html5 with Connection between websocket servers is then based on websocket server push websocket data to front end Html5 user, front end html5 use event trigger mechanism, processing are filtered to repeating websocket data, after filtering Data be shown to user, new websocket data whether are received in front end html5 detection preset times, if so, connecing By new websocket data, if it is not, then:Whether correct http request verification data set is performed, if so, using Websocket agreements transmit data, if it is not, then:It performs http agreements and obtains data;Judge whether verification terminates, if so, It performs http request and calls and terminate data, used based on websocket server push global message data to the front end html5 Family.Using http agreements and and websocket protocol, rationally using websocket agreements progress message sink, then utilize Http agreements carry out data check and the message lost carries out data correction, solve the problems, such as that data front and back end is inconsistent.And A global message data are asked when calling and terminating data, using repeated duplicate removal principle without causing data weight It is multiple, therefore, correct situation is verified back in the case that partial data is unreceived.
Specifically, in the above-described embodiments, based on websocket server push websocket data to front end html5 Can be that websocket servers seal data into json data, then pass through websocket protocol or http during user Agreement is transferred to front end html5, after front end html5 receives data, advanced row data deduplication processing, then using the tactile of event Hair mechanism according to the key-value form trigger events of json, then generates different effects and is presented to user.
Specifically, in the above-described embodiments, front end html5 uses event trigger mechanism, to repeating websocket data Processing is filtered, the data after filtering are shown to user to be, front end html5 receives the duplicate removal mechanism after data, Front end html5 caches De-weight method using data acquisition system, first stores the data transmitted into map objects, then basis Be packaged into a singleton pattern, the first step first to event handling when by singleton pattern obtain whether the data in map objects deposit Duplicate removal processing is being carried out, is being repeated data if data are had found, second step duplicate removal is regular using dom trees duplicate removal, according to The effect that event trigger mechanism generates, then judges whether the triggering event.
Specifically, in the above-described embodiments, preset time can be 1.5 seconds.
In order to more specifically emphasize the independence implemented, this specification is related to number of modules or unit.For example, mould Block or unit can be realized that the hardware circuit includes special VLSI circuits OR gate array, such as logic chip, crystal by hardware circuit Pipe or other components.Module or unit can also be realized in programmable computer hardware, for example field is imitated programmable gate array, can be compiled Journey array logic, programmable logic device etc..
Module or unit can also be realized in by the software performed by various forms of processors.Such as one can hold Row code module may include one or more entities or logic computer instruction block, which is formed into, such as, Object, program or function.However, the executable part of identification module or unit need not physically be put together, but can be by The different instruction for being stored in different position is formed, and when combining in logic, is formed module or unit and is reached the module Or the purpose required by unit.
In fact, executable code module or unit can be a single instruction or multiple instruction, it might even be possible to which distribution is in place In several different code sections of different programs, and across several storage devices.Similarly, operation data can be identified and It is shown in this module or unit, and can implement in any suitable form and in any suitable data structure form Tissue.Operation data can assemble single data set or can be distributed in the different positions with different storage devices, and Only it is present in a system or network in a manner of electronic signal at least partly.
" embodiment " or similar term mentioned by this specification represent characteristic, structure or the feature related with embodiment, It is included in at least embodiment of the present invention.Therefore, this specification occurs term " in one embodiment " " is being implemented In example " and similar to term possibility but it is not necessarily all direction identical embodiment.
Furthermore characteristic of the present invention, structure or feature can be incorporated in one or more embodiments in any way In.Explanation will provide many specific details, such as programming, software module, user's selection, network trading, database below The examples such as inquiry, database structure, hardware module, hardware circuit, hardware chip, to provide the understanding to the embodiment of the present invention. However those of ordinary skill in the related art will be seen that the present invention, even if using wherein one or more specific details or Can also it be implemented using other methods, component, material etc..On the other hand, be the present invention that avoids confusion, well known structure, material or Operation does not have a detailed description.
Each embodiment is described by the way of progressive in this specification, the highlights of each of the examples are with other The difference of embodiment, just to refer each other for identical similar portion between each embodiment.For device disclosed in embodiment For, since it is corresponded to the methods disclosed in the examples, so description is fairly simple, related part is said referring to method part It is bright.
Professional further appreciates that, with reference to each exemplary unit of the embodiments described herein description And algorithm steps, can be realized with the combination of electronic hardware, computer software or the two, in order to clearly demonstrate hardware and The interchangeability of software generally describes each exemplary composition and step according to function in the above description.These Function is performed actually with hardware or software mode, specific application and design constraint depending on technical solution.Specialty Technical staff can realize described function to each specific application using distinct methods, but this realization should not Think beyond the scope of this invention.
It can directly be held with reference to the step of method or algorithm that the embodiments described herein describes with hardware, processor The combination of capable software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only deposit Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology In any other form of storage medium well known in field.
The foregoing description of the disclosed embodiments enables professional and technical personnel in the field to realize or use the present invention. A variety of modifications of these embodiments will be apparent for those skilled in the art, it is as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, this hair It is bright to be not intended to be limited to the embodiments shown herein, and be to fit to and the principles and novel features disclosed herein Consistent most wide scope.

Claims (10)

1. a kind of instant data transmission method based on websocket protocol Yu http agreements, which is characterized in that including:
Establish the connection between html5 and the websocket server of front end;
Based on the websocket server push websocket data to the front end html5 user;
The front end html5 uses event trigger mechanism, processing is filtered to repeating websocket data, after filtering Data are shown to the user;
New websocket data whether are received in the front end html5 detections preset time, if so, receiving described new Websocket data, if it is not, then:
Whether correct perform http request verification data set, if so, data are transmitted using websocket protocol, if it is not, Then:
It performs http agreements and obtains data;
Judge whether verification terminates, terminate data if so, performing http request and calling.
2. according to the method described in claim 1, it is characterized in that, described be based on the websocket server push Websocket data include to the front end html5 user:
The websocket data are packaged into json data by the websocket servers;
Based on websocket protocol or http agreements by the json data transmissions to the front end html5 user.
3. according to the method described in claim 1, it is characterized in that, the front end html5 uses event trigger mechanism, to repeating Websocket data are filtered processing, and the data after filtering are shown to the user includes:
The front end html5 caches duplicate removal mode counterweight according to the key-value form trigger events of json using data acquisition system Multiple websocket data are filtered processing, and the data after filtering are shown to the user.
4. according to the method described in claim 1, it is characterized in that, after the execution http request calling end data, also wrap It includes:
Based on the websocket server push global message data to the front end html5 user.
5. according to the method described in claim 1, it is characterized in that, the preset time is 1.5 seconds.
6. a kind of instant data transmission system based on websocket protocol Yu http agreements, which is characterized in that including:
Module is established, for establishing the connection between html5 and the websocket server of front end;
Pushing module, for being based on the websocket server push websocket data to the front end html5 user;
Data processing module for the front end html5 using event trigger mechanism, was carried out to repeating websocket data Filter is handled, and the data after filtering are shown to the user;
Detection module, for whether receiving new websocket data in front end html5 detection preset times;
Receiving module, for when receiving new websocket data in front end html5 detection preset times, receiving The new websocket data;
Correction verification module, for when not receiving new websocket data in front end html5 detection preset times, holding Whether row http request verification data set is correct;
Transport module, for when execution http request verification data set is correct, websocket protocol being used to transmit data;
Acquisition module, for when execution http request verification data set is incorrect, performing http agreements and obtaining data;
Judgment module, for judging whether verification terminates;
Calling module terminates data at the end of verification is judged, performing http request and calling.
7. system according to claim 6, which is characterized in that the pushing module is specifically used for:
The websocket data are packaged into json data by the websocket servers;
Based on websocket protocol or http agreements by the json data transmissions to the front end html5 user.
8. system according to claim 6, which is characterized in that the data processing module is specifically used for:
The front end html5 caches duplicate removal mode counterweight according to the key-value form trigger events of json using data acquisition system Multiple websocket data are filtered processing, and the data after filtering are shown to the user.
9. system according to claim 6, which is characterized in that the pushing module is additionally operable to:
Based on the websocket server push global message data to the front end html5 user.
10. system according to claim 6, which is characterized in that the preset time is 1.5 seconds.
CN201810166029.5A 2018-02-28 2018-02-28 Instant data transmission method and system based on websocket protocol and http protocol Active CN108111634B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810166029.5A CN108111634B (en) 2018-02-28 2018-02-28 Instant data transmission method and system based on websocket protocol and http protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810166029.5A CN108111634B (en) 2018-02-28 2018-02-28 Instant data transmission method and system based on websocket protocol and http protocol

Publications (2)

Publication Number Publication Date
CN108111634A true CN108111634A (en) 2018-06-01
CN108111634B CN108111634B (en) 2020-11-20

Family

ID=62205780

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810166029.5A Active CN108111634B (en) 2018-02-28 2018-02-28 Instant data transmission method and system based on websocket protocol and http protocol

Country Status (1)

Country Link
CN (1) CN108111634B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110730206A (en) * 2019-09-06 2020-01-24 浪潮金融信息技术有限公司 Data service scheme applied to data display of new retail platform
CN111447252A (en) * 2020-02-19 2020-07-24 深圳点猫科技有限公司 Method and system for realizing interactive input based on websocket
CN112000494A (en) * 2020-08-28 2020-11-27 北京焦点新干线信息技术有限公司 Instant data transmission method and system
CN112118266A (en) * 2020-09-24 2020-12-22 焦点科技股份有限公司 Distributed state synchronization method based on cooperation of HTTP and WebSocket
CN112565421A (en) * 2020-12-03 2021-03-26 创盛视联数码科技(北京)有限公司 Information transmission method, system, electronic device and storage medium
CN113422760A (en) * 2021-06-10 2021-09-21 杭州安恒信息技术股份有限公司 Data transmission method, device, electronic device and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103095819A (en) * 2013-01-04 2013-05-08 微梦创科网络科技(中国)有限公司 Data information pushing method and data information pushing system
CN103945003A (en) * 2014-05-06 2014-07-23 北京邮电大学 Dynamic self-adapting method for connection of Web RTC (Real Time Communication) client
US9137288B2 (en) * 2010-12-20 2015-09-15 Yahoo! Inc. Scalable push-based architecture for web applications
CN106330994A (en) * 2015-06-18 2017-01-11 天脉聚源(北京)科技有限公司 User message publishing method and system
CN107070737A (en) * 2017-02-07 2017-08-18 济南浪潮高新科技投资发展有限公司 A kind of singal reporting code data real-time monitoring system and method
CN107342934A (en) * 2017-06-19 2017-11-10 浪潮金融信息技术有限公司 A kind of mixed mode Mobile solution real-time messages method for pushing and system based on WebSocket
CN107438058A (en) * 2016-05-27 2017-12-05 北京京东尚科信息技术有限公司 The filter method and filtration system of user's request
CN107637040A (en) * 2015-05-13 2018-01-26 高通股份有限公司 Carry out transmission media data using WEBSOCKET sub-protocols

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9137288B2 (en) * 2010-12-20 2015-09-15 Yahoo! Inc. Scalable push-based architecture for web applications
CN103095819A (en) * 2013-01-04 2013-05-08 微梦创科网络科技(中国)有限公司 Data information pushing method and data information pushing system
CN103945003A (en) * 2014-05-06 2014-07-23 北京邮电大学 Dynamic self-adapting method for connection of Web RTC (Real Time Communication) client
CN107637040A (en) * 2015-05-13 2018-01-26 高通股份有限公司 Carry out transmission media data using WEBSOCKET sub-protocols
CN106330994A (en) * 2015-06-18 2017-01-11 天脉聚源(北京)科技有限公司 User message publishing method and system
CN107438058A (en) * 2016-05-27 2017-12-05 北京京东尚科信息技术有限公司 The filter method and filtration system of user's request
CN107070737A (en) * 2017-02-07 2017-08-18 济南浪潮高新科技投资发展有限公司 A kind of singal reporting code data real-time monitoring system and method
CN107342934A (en) * 2017-06-19 2017-11-10 浪潮金融信息技术有限公司 A kind of mixed mode Mobile solution real-time messages method for pushing and system based on WebSocket

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
金丰等: "基于双服务器的 B /S 模式监测系统的设计与实现", 《计算机仿真》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110730206A (en) * 2019-09-06 2020-01-24 浪潮金融信息技术有限公司 Data service scheme applied to data display of new retail platform
CN111447252A (en) * 2020-02-19 2020-07-24 深圳点猫科技有限公司 Method and system for realizing interactive input based on websocket
CN111447252B (en) * 2020-02-19 2023-09-26 深圳点猫科技有限公司 Method and system for realizing interactive input based on websocket
CN112000494A (en) * 2020-08-28 2020-11-27 北京焦点新干线信息技术有限公司 Instant data transmission method and system
CN112118266A (en) * 2020-09-24 2020-12-22 焦点科技股份有限公司 Distributed state synchronization method based on cooperation of HTTP and WebSocket
CN112118266B (en) * 2020-09-24 2022-05-31 焦点科技股份有限公司 Distributed state synchronization method based on cooperation of HTTP and WebSocket
CN112565421A (en) * 2020-12-03 2021-03-26 创盛视联数码科技(北京)有限公司 Information transmission method, system, electronic device and storage medium
CN112565421B (en) * 2020-12-03 2022-01-25 创盛视联数码科技(北京)有限公司 Information transmission method, system, electronic device and storage medium
CN113422760A (en) * 2021-06-10 2021-09-21 杭州安恒信息技术股份有限公司 Data transmission method, device, electronic device and storage medium

Also Published As

Publication number Publication date
CN108111634B (en) 2020-11-20

Similar Documents

Publication Publication Date Title
CN108111634A (en) A kind of instant data transmission method and system based on websocket protocol Yu http agreements
CN106341558B (en) Processing method, device and the server of virtual-number
CN104967644B (en) Information push method, apparatus and system
CN105577799B (en) A kind of fault detection method and device of data-base cluster
CN111835790B (en) Risk identification method, device and system
CN103023906A (en) Method and system aiming at remote procedure calling conventions to perform status tracking
CN105306554B (en) A kind of method of data synchronization and local server
CN109962855A (en) A kind of current-limiting method of WEB server, current-limiting apparatus and terminal device
CN109582655B (en) Method and device for positioning system log and computer readable storage medium
CN108052094A (en) A kind of extension card identification method, device and frequency converter
CN110502527A (en) Method, apparatus, computer equipment and the storage medium of background request anti-replay
CN108989413A (en) Abnormal traffic compensation method, device, computer equipment and storage medium
CN109408139A (en) Open method, device, computer equipment and the storage medium of application program
CN106487883A (en) Network registration process method and module
CN107480117A (en) Automate the restoration methods and device of page table list data
CN109376089A (en) A kind of automatic test management method and system
CN103778026A (en) Object calling method and device
CN113434293A (en) Method and apparatus for processing repeat request, storage medium, and electronic apparatus
CN107678955A (en) A kind of computational methods, device, equipment and the storage medium of functional interface time delay
CN106777228A (en) Message pushing method and device and electronic equipment
CN103927191B (en) Resource allocation method and resource allocation device for invoking function
CN110377441A (en) Positioning problems method, apparatus, equipment and storage medium on application software of calling a taxi line
CN102937934B (en) Telemetry is caught by dynamic language engine
CN103036895B (en) A kind of status tracking method and system
CN105577758B (en) A kind of page heartbeat message processing method and client

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20231113

Address after: 100190 901-1, Floor 9, Building 3, No. 2 Academy South Road, Haidian District, Beijing

Patentee after: Beijing Bodian Zhihe Technology Co.,Ltd.

Address before: 100086 20 / F, block C, No.2, south academy of Sciences Road, Haidian District, Beijing

Patentee before: BEIJING JIAODIAN XINGANXIAN INFORMATION TECHNOLOGY CO.,LTD.