CN105897792A - Message loss prevention method in comet technology - Google Patents

Message loss prevention method in comet technology Download PDF

Info

Publication number
CN105897792A
CN105897792A CN201410692336.9A CN201410692336A CN105897792A CN 105897792 A CN105897792 A CN 105897792A CN 201410692336 A CN201410692336 A CN 201410692336A CN 105897792 A CN105897792 A CN 105897792A
Authority
CN
China
Prior art keywords
serial number
client
message
server
news
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.)
Pending
Application number
CN201410692336.9A
Other languages
Chinese (zh)
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 VRV Software Corp Ltd
Original Assignee
Beijing VRV Software Corp 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 VRV Software Corp Ltd filed Critical Beijing VRV Software Corp Ltd
Priority to CN201410692336.9A priority Critical patent/CN105897792A/en
Publication of CN105897792A publication Critical patent/CN105897792A/en
Pending legal-status Critical Current

Links

Landscapes

  • Communication Control (AREA)

Abstract

The invention provides a message loss prevention method in a comet technology, and belongs to the comet technology based communication field. According to the invention, a serial number is added to http persistent connection sent by a client, a serial number is also added to a message pushed to the client by a server, and then matching is carried out on a serial number received by the server and a serial number in a temporary buffer area. If the serial number received by the server is matched with the serial number in the temporary buffer area, it is indicated that the client already receives the message pushed by the server; and if the serial number received by the server is not matched with the serial number in the temporary buffer area, it is indicated that the client loses the message pushed by the server. Through the mechanism provided by the invention, the client in the http persistent connection can be ensured to receive messages according to a correct sequence, and the message are prevented from being lost.

Description

A kind of message anti-loss method in comet technology
Technical field
The present invention relates to the message anti-loss method in a kind of comet technology, belong to the communications field based on comet technology.
Background technology
Comet connects " server push " technology based on HTTP length, and being exactly briefly client transmission one please Asking, server receives it, and uses an Infinite Cyclic, in data push to the response that client is needed, And refresh, but this response is not turned off, and continues to new data and refreshes, until client disconnects Connecting, this circulation just terminates to exit.
Comet is particularly well-suited to need and the application of server end real-time, interactive, such as monitoring, instant messaging, i.e. Times Valency system is required in real time the change that backstage occurs being sent to client and ceaselessly refreshing without client, send and ask Ask.
In the various application of Comet technology, when server sends real-time messages to client, due to network reason With terminal self reason, it is likely to result in information drop-out.But, there is presently no in solution Comet technology and prevent message The method lost.
Summary of the invention
For solving the problems referred to above, the invention provides the message anti-loss method in a kind of comet technology.By this mechanism, The present invention ensure that the client in the connection of http length collects message in the correct order, prevents information drop-out.
The invention provides following scheme:
1. client obtains serial number.
Wherein, the form of original state is not limited to serial number, as long as the mode that client and server is reserved in advance in advance, It is able to confirm that first of client asks.In addition to original state, other serial number is to client by server The mode that end pushes obtains.
2. client sends the connection of http length, adds serial number in http length connects.
Wherein, upper http length has been connected reply message and serial number backs up to extra buffer.
Extra buffer in server, is used for storing serial number and message backup.Extra buffer is ephemeral data storage Region, can be the region that can store data such as internal memory or disk, the form of scratchpad area (SPA) not as this patent must Want condition.Every http connects corresponding unique serial number.
When message is pushed to client by server, now need to carry out message backup in extra buffer, only when After server confirms that client receives this message, just the message of extra buffer is backed up and remove.
3. received server-side connects to http length, analyzes during this length connects the serial number carried.
4. the serial number in this http length being connected is carried out with the serial number of the message of storage in server end extra buffer Coupling.
If the serial number that 5. in extra buffer, the serial number of the message of storage carries in connecting with http length is consistent, explanation Client have received a piece of news, then removed by the upper a piece of news that extra buffer backs up.Then server Lower a piece of news in message queue is sent to client, this message is put in extra buffer simultaneously and backs up, treats After confirming that client receives this message, then by this message erasing.
6., if the serial number that in relief area, the serial number of storage carries in asking with length is inconsistent, illustrate that a piece of news is lost Losing, now the upper a piece of news backed up in relief area is sent to client by server end again, until confirming that client is received To upper a piece of news.
The present invention adds serial number in being connected by the http length sent in client, pushes away to client at server simultaneously Also adding serial number in the message sent, the serial number then received by server is carried out with the serial number in extra buffer Coupling.If coupling is consistent, illustrate that client has been received by the message of server push;If inconsistent, illustrate that client is lost Lose the message of server push.By using the method, it is possible to effectively prevent the information drop-out in comet technology.
Accompanying drawing explanation
Fig. 1 is the message anti-loss method schematic diagram in comet technology.
Fig. 2 is to set up flow chart when the 1st article of http length connects.
Fig. 3 is the flow chart that client receives N-1 article of message.
Fig. 4 is the flow chart that client loses N-1 article of message.
Detailed description of the invention
Message anti-loss method in a kind of comet technology that the present invention proposes, in conjunction with accompanying drawing and implement detailed example and be described as follows.
The schematic diagram of the message anti-loss method in Comet technology, as shown in Figure 1.User end to server sends http Long connection, after server judges, pushes to client by message.Server increases an extra buffer, uses In storage serial number and message backup.
The flow process of the message anti-loss method being specifically described below in comet technology, first to set up the 1st article of http length As a example by connection, comprise the following steps.
S1. client sends the 1st article of http length connection and initial validation testing.
S2. server receives the 1st article of http length connection and the initial validation testing that client sends.
S3. the initial sequence number received is mated by server with the serial number of storage in extra buffer.In service Before device receives the connection of http length, in extra buffer, storage is initial validation testing, and therefore coupling is consistent.
S4. renewal sequence number in extra buffer, and the message corresponding to the connection of this http length is backed up.
S5. this message of server push is to client.
In order to express easily, the serial number after updating can be referred to as the 1st serial number, this message of server push is the Article 1, message, by that analogy.
It is generalized to generally, receives as a example by the N-1 article message by client, as it is shown on figure 3, comprise the following steps.
S1. client receives the N-1 article message, and now carry in message is n-th serial number.
Although client has received the N-1 article message, but server also confirms, now deposits in extra buffer That stores up remains the N-1 article message and n-th serial number.
S2. user end to server sends the serial number N that the N article http length connects and receives in step S1.
S3. server receives the N article http length connection and the n-th serial number that client sends.
S4. the serial number N received is mated by server with the serial number of storage in extra buffer.By step S1 Understanding, now store in extra buffer is n-th serial number, and the serial number received with server is consistent, therefore Server confirms that client has been properly received the N-1 article message.
S5. extra buffer is removed the N-1 article and is replied message and n-th serial number, backs up the N article simultaneously and replies message With the N+1 serial number.
S6. the N article is replied message and sends to client with the N+1 serial number by server.
In order to situation when client loses N-1 article of message is described, as shown in Figure 4, comprise the following steps.
S1. server confirms that client loses the N-1 article message.
S2. the content of storage in server calls extra buffer.Extra buffer stores message and serial number.
S3. the message in extra buffer and serial number are pushed to client by server again, until server confirms visitor Family end receives this message.

Claims (3)

1. the message anti-loss method in a comet technology, it is characterised in that the method comprising the steps of:
S1. client obtains serial number;
S2. 2. clients send the connection of http length, add serial number in http length connects;
S3. received server-side connects to http length, analyzes during this length connects the serial number carried.
S4. in serial number and the server end extra buffer in this http length being connected, the serial number of the message of storage is carried out Join;
If the serial number that S5. in extra buffer, the serial number of the message of storage carries in connecting with http length is consistent, client is described End have received a piece of news, then the lower a piece of news in server end message queue is sent to client;
If the serial number that S6. in relief area, the serial number of storage carries in asking with length is inconsistent, illustrate that a piece of news is lost, this Time server end the upper a piece of news backed up in relief area is sent again to client, until confirming that client receives one and disappears Breath.
Message anti-loss method in comet technology the most according to claim 1, it is characterised in that
In step sl, the form of original state is not limited to serial number, as long as the mode that client and server is reserved in advance in advance, It is able to confirm that first of client asks.In addition to original state, other serial number is to be pushed away to client by server The mode sent obtains.
Message anti-loss method in comet technology the most according to claim 1, it is characterised in that in step S5 In, if the serial number that in extra buffer, the serial number of the message of storage carries in connecting with http length is consistent, illustrate that client is Through have received upper a piece of news, then the upper a piece of news that extra buffer backs up is removed.Then in server message queue Lower a piece of news is sent to client, this message is put in extra buffer simultaneously and backs up.
CN201410692336.9A 2014-11-27 2014-11-27 Message loss prevention method in comet technology Pending CN105897792A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410692336.9A CN105897792A (en) 2014-11-27 2014-11-27 Message loss prevention method in comet technology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410692336.9A CN105897792A (en) 2014-11-27 2014-11-27 Message loss prevention method in comet technology

Publications (1)

Publication Number Publication Date
CN105897792A true CN105897792A (en) 2016-08-24

Family

ID=56699106

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410692336.9A Pending CN105897792A (en) 2014-11-27 2014-11-27 Message loss prevention method in comet technology

Country Status (1)

Country Link
CN (1) CN105897792A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106713328A (en) * 2016-12-29 2017-05-24 北京奇虎科技有限公司 Information processing method and apparatus based on long connection
CN106790728A (en) * 2017-03-30 2017-05-31 北京深思数盾科技股份有限公司 information push method and system
CN106941461A (en) * 2017-02-23 2017-07-11 江苏徐工信息技术股份有限公司 A kind of method that utilization message queue optimizes server processing requests
CN108173807A (en) * 2017-11-28 2018-06-15 贵阳语玩科技有限公司 Unified message is sent, processing method and processing device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102480517A (en) * 2010-11-30 2012-05-30 北京千橡网景科技发展有限公司 Data push method, mobile terminal and server
CN102881183A (en) * 2012-09-28 2013-01-16 方正国际软件有限公司 Public transport line bamboo joint map real-time interactive system
CN103237048A (en) * 2013-03-13 2013-08-07 山西省电力公司大同供电分公司 Real-time warning system and real-time warning method of B/S framework in electrical power system
US20140280522A1 (en) * 2011-02-02 2014-09-18 Imvu Inc. System and method for providing an actively invalidated client-side network resource cache

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102480517A (en) * 2010-11-30 2012-05-30 北京千橡网景科技发展有限公司 Data push method, mobile terminal and server
US20140280522A1 (en) * 2011-02-02 2014-09-18 Imvu Inc. System and method for providing an actively invalidated client-side network resource cache
CN102881183A (en) * 2012-09-28 2013-01-16 方正国际软件有限公司 Public transport line bamboo joint map real-time interactive system
CN103237048A (en) * 2013-03-13 2013-08-07 山西省电力公司大同供电分公司 Real-time warning system and real-time warning method of B/S framework in electrical power system

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106713328A (en) * 2016-12-29 2017-05-24 北京奇虎科技有限公司 Information processing method and apparatus based on long connection
CN106941461A (en) * 2017-02-23 2017-07-11 江苏徐工信息技术股份有限公司 A kind of method that utilization message queue optimizes server processing requests
CN106790728A (en) * 2017-03-30 2017-05-31 北京深思数盾科技股份有限公司 information push method and system
CN108173807A (en) * 2017-11-28 2018-06-15 贵阳语玩科技有限公司 Unified message is sent, processing method and processing device
CN108173807B (en) * 2017-11-28 2021-12-03 贵阳语玩科技有限公司 Unified message sending and processing method and device

Similar Documents

Publication Publication Date Title
US10764369B2 (en) Data storage method and server applicable to distributed server cluster
PH12019501717A1 (en) Achieving consensus among network nodes in a distributed system
CN105897792A (en) Message loss prevention method in comet technology
CN105991412B (en) Information push method and device
CN105450682B (en) Method, device and system for synchronously storing data and synchronizing data to client
CN107395559B (en) Data processing method and device based on redis
CN106254220A (en) The management method of instant messaging group and device
EP3028437A1 (en) Messaging api over http protocol to establish context for data exchange
CN108880972B (en) Information processing method, server and terminal
US20150186485A1 (en) Robust communication system for guaranteed message sequencing with the detection of duplicate senders
CN109391691A (en) The restoration methods and relevant apparatus that NAS is serviced under a kind of single node failure
KR102150210B1 (en) Blockchain network
CN110442461A (en) A kind of message dilivery method, storage medium
CN105302486A (en) Virtual offline desktop block device storage synchronization method
US11418553B2 (en) Video connection method and apparatus, and non-transitory computer-readable storage medium
US20140250165A1 (en) Method and Devices for Session Timeout Management
CN104821889B (en) A kind of processing method and equipment of backup message
WO2011034771A4 (en) Facilitating interoperability among communication systems via inter- and intra-agency communications using a shared network
CN104899277A (en) Message distribution method and apparatus
CN103503358A (en) A method and an apparatus for message interaction of group resources
CN113765745A (en) Service performance testing method and device, terminal equipment and storage medium
CN104166820A (en) Data management method and system
CN110890989A (en) Channel connection method and device
CN104580512A (en) Data processing method and device and distributed file system
CN105391623A (en) Temporary offline session message reservation method, apparatus and 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
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20160824

RJ01 Rejection of invention patent application after publication