Message synchronization method, system and deviceTechnical field
The present invention relates to message synchronization technical field more particularly to a kind of message synchronization method, system and device.
Background technique
Instant messaging (Instant Message) is a kind of real-time communication service for allowing user to establish connection by network.With the rapid development of mobile Internet, the outburst of the various terminals such as mobile phone, tablet computer, smart television, the mode that user links upGradually tend to multiple terminals, and when user switches between multiple terminals, needs to keep the consistent experience of instant messaging application.
Currently, the message sink at different ends may be implemented in existing message push mode, it is in user while logs in handWhen generator terminal and computer end, while message can be pushed to computer, it is pushed to mobile phone terminal.But it is multiple in face of mobile InternetMiscellaneous network traffic conditions, the message for being pushed to mobile terminal can not be often sent to, and in the case where mass users scale,Storage push failed message can consume a large amount of storage resource, largely push again to also seriously consuming server resource.
In summary, the existing technology has inconveniences and defects in actual use, so it is necessary to be improved.
Summary of the invention
It, can be with the purpose of the present invention is to provide a kind of message synchronization method, system and device for above-mentioned defectBetter synchronization message.
To achieve the goals above, the present invention provides a kind of message synchronization method, the method includes:
A, synchronization request is received, newest first message sequence number is sent to terminal side;
B, terminal side is by locally-stored newest second message sequence number and the comparative analysis of first message sequence number;
C, according to the comparing result of first message sequence number and second message sequence number, synchronization message content is sent.
Message synchronization method according to the present invention, step A further include before:The generation strategy of presetting message sequence number.
Message synchronization method according to the present invention, the generation strategy of the message SN are specially:By message send orReceiving time setting incremented by successively.
Message synchronization method according to the present invention, the step C include:
If second message sequence number is less than first message sequence number, synchronous message synchronization will be needed to corresponding terminalSide.
The present invention also provides a kind of message synchronization systems, including:
Newest first message sequence number is sent to terminal side for receiving synchronization request by transmission unit;
Comparing unit, for dividing locally-stored newest second message sequence number compared with first message sequence numberAnalysis;
Synchronous processing unit, according to the comparing result of first message sequence number and second message sequence number, transmission, which synchronizes, to disappearCease content.
Message synchronization system according to the present invention further includes
Setting unit, the generation strategy for presetting message sequence number.
Message synchronization system according to the present invention, the setting unit send or receive the time by message and incremented by successively setIt sets.
Message synchronization system according to the present invention, if second message sequence number is less than first message sequence number, it is synchronous atManaging unit needs synchronous message synchronization to corresponding terminal side.
The present invention also provides a kind of synchronizing devices including system as described above.
The present invention sends newest first message sequence number after synchronization request by setting transmission unit, for receivingTo terminal side;And locally-stored newest second message sequence number is divided compared with first message sequence number by comparing unitAnalysis;Synchronous processing unit is sent in synchronization message according to the comparing result of first message sequence number and second message sequence numberHold.If second message sequence number is less than first message sequence number, synchronous message synchronization will be needed to corresponding terminal side.It borrowsThis, can better synchronization message.
Detailed description of the invention
Fig. 1 is message synchronization method flow diagram of the invention;
Fig. 2 is message synchronization system construction drawing of the invention.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, rightThe present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, andIt is not used in the restriction present invention.
Referring to Fig. 1, a kind of message synchronization system of the present invention, message when logging in multiple terminals applied to same user is sameStep mechanism, the synchronization system 100 include:
Newest first message sequence number is sent to terminal side after synchronization request for receiving by transmission unit 10.Specifically, when a certain user logs in multiple terminals by an application, due to terminal itself or communication, message difference can be generatedThe case where step.To solve this problem, a preset setting unit 40 in system 100, the generation plan for presetting message sequence numberSlightly, time setting incremented by successively specially is sent or received by message.
Comparing unit 20, for dividing locally-stored newest second message sequence number compared with first message sequence numberAnalysis.There is the latest sequence number of each message terminal side, since message SN has stringent incremental order, ifIf first message sequence number cannot be matched with second message sequence number, description messages are not carried out synchronization, and by comparing resultIt is sent to the processing of synchronous processing unit 30.
Synchronous processing unit 30 sends and synchronizes according to the comparing result of first message sequence number and second message sequence numberMessage content.Synchronous processing unit 30 can obtain corresponding according to the difference of first message sequence number and second message sequence numberThe message content of terminal side missing, and corresponding terminal side is sent it to, terminal side while update message sequence number.
Usually, if not synchronizing, second message sequence number can be less than first message sequence number, can according to this kind comparisonConveniently to obtain non-synchronizing information, and sends it to terminal and complete to synchronize.
The present invention also provides a kind of synchronizing devices including above system 100, can correspond to message server.
Referring to fig. 2, the present invention accordingly provides a kind of message synchronization method, can be real by system 100 as shown in Figure 1Existing, this method includes:
Newest first message sequence number is sent to terminal side after receiving synchronization request by step S201.Specifically, a certainWhen user logs in multiple terminals by an application, due to terminal itself or communication, the nonsynchronous feelings of message can be generatedCondition.To solve this problem, a preset setting unit 40 in system 100, for the generation strategy of presetting message sequence number, specificallyTo send or receive time setting incremented by successively by message.
Step S202, by locally-stored newest second message sequence number and the comparative analysis of first message sequence number.EventuallyThere is the latest sequence number of each message end side, since message SN has stringent incremental order, if first disappearsIf breath sequence number cannot be matched with second message sequence number, description messages are not carried out synchronization, and comparing result is sent toThe processing of synchronous processing unit 30.The comparison of the step can be realized by terminal side, can also be realized by service side.
Step S203, the comparing result of first message sequence number and second message sequence number send synchronization message content.TogetherCorresponding terminal side missing can be obtained according to the difference of first message sequence number and second message sequence number by walking processing unit 30Message content, and corresponding terminal side is sent it to, terminal side while update message sequence number.
Usually, if not synchronizing, second message sequence number can be less than first message sequence number, can according to this kind comparisonConveniently to obtain non-synchronizing information, and sends it to terminal and complete to synchronize.
In conclusion the present invention is by setting transmission unit, for receiving newest first message after synchronization requestSequence number is sent to terminal side;And by comparing unit by locally-stored newest second message sequence number and first message sequenceRow number comparative analysis;Synchronous processing unit is sent same according to the comparing result of first message sequence number and second message sequence numberWalk message content.If second message sequence number is less than first message sequence number, synchronous message synchronization will be needed to correspondingTerminal side.It whereby, can better synchronization message.
Certainly, the present invention can also have other various embodiments, without deviating from the spirit and substance of the present invention, ripeIt knows those skilled in the art and makes various corresponding changes and modifications, but these corresponding changes and change in accordance with the present inventionShape all should fall within the scope of protection of the appended claims of the present invention.