Method and device for obtaining and synchronizing instant messaging messages
By selecting initial judgment conditions according to the message type in the chat room interface of the instant messaging software, using a unified data acquisition and synchronization method to obtain and store messages from the local database and server, the complex storage logic problems caused by different message acquisition solutions on different terminal devices are solved, and efficient maintenance and continuity of messages are achieved.
Patent Information
- Application Number
- CN202310690111.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2043-06-12
AI Technical Summary
When existing instant messaging software synchronizes messages on different terminal devices, the acquisition schemes of historical messages, new messages and offline messages are different, resulting in complex storage logic and difficult maintenance.
By selecting the initial judgment conditions according to the type of the target conversation message in the chat room interface of the instant messaging software, and using the same data acquisition and synchronization method to obtain and store messages from the local database and server, including historical conversations, offline conversations and new conversation types, use the batch number to be sent and received to mark new messages and reset them when exiting or long connection is disconnected, the mobile terminal determines the message continuity.
It simplifies the storage logic of message data, improves the efficiency of message maintenance, reduces the waste of back-end resources, and ensures the integrity and continuity of messages on different terminal devices.
Smart Images

Figure CN116489118B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of instant messaging, and in particular, to a method and device for obtaining and synchronizing instant messaging messages. Background Art
[0002] With the development of the Internet, Internet instant messaging software has become an application that most people often use. At the same time, with the widespread application of mobile terminals, many users own multiple terminal devices. This means that users may use the same instant messaging App on different terminal devices at the same time, which will cause different messages to be scattered and stored on different devices, resulting in missing historical messages on one device. Generally speaking, the backend database server corresponding to the Internet instant messaging software will store all the messages sent by users. This means that as long as the messages are received by the backend database server, the messages in the database server are complete. Based on this, to improve the reading experience of users on different terminal devices, a synchronization mechanism can be used to synchronize the continuous messages in the backend database to the mobile device to prevent missing historical messages on one device.
[0003] In the existing technology of synchronizing continuous messages in the backend database to mobile devices, different schemes are adopted for obtaining historical messages, new messages, and offline messages in chat rooms, which makes the storage logic of message data relatively complex and difficult to maintain. Summary of the Invention
[0004] In view of this, the embodiments of this application provide a method and device for obtaining and synchronizing instant messaging messages to eliminate or improve one or more defects existing in the prior art.
[0005] The first aspect of this application provides a method for obtaining and synchronizing instant messaging messages, the method includes:
[0006] Select a corresponding initial judgment condition according to the type of target conversation message requested by the user in the chat room interface of the instant messaging software;
[0007] If the initial judgment condition can be satisfied, then use the same data acquisition and synchronization method to retrieve the target conversation messages within a preset display period from the local database, and display the retrieved target conversation messages in the chat room interface; the local database includes a message table;
[0008] Wherein, the data acquisition and synchronization method includes: obtaining the conversation message content of the type of the target conversation message within multiple preset display periods from the server of the instant messaging software according to the type of the target conversation message and storing it in the message table.
[0009] In some embodiments of the present application, after displaying the re-fetched target conversation message in the chat room interface, it further includes:
[0010] If the user sends a new message or receives the new message, mark the new message with a batch number for sending and receiving and store the new message in the message table; wherein, if the batch number for sending and receiving does not exist, randomly generate the batch number for sending and receiving.
[0011] If it is detected that the user exits the application or the long connection where the user is located is disconnected, reset the batch number for sending and receiving.
[0012] In some embodiments of the present application, if the type of the target conversation message is: historical conversation type; correspondingly, the initial judgment conditions selected according to the type of the target conversation message requested by the user in the chat room interface of the instant messaging software include:
[0013] If it is detected that the user performs a pull-down operation in the chat room interface to obtain historical chat messages, search for the target historical conversation message set within the preset display period from the local database.
[0014] Judge whether the target historical conversation message set is continuous with the message content currently displayed in the chat room interface. If not, the initial judgment condition is satisfied.
[0015] In some embodiments of the present application, if the type of the target conversation message is: non-historical conversation type; the non-historical conversation type includes: offline conversation type and new conversation type; correspondingly, the initial judgment conditions selected according to the type of the target conversation message requested by the user in the chat room interface of the instant messaging software include:
[0016] Judge whether the chat room has requested the content of the conversation message of the non-historical conversation type after the user enters the chat room corresponding to the chat room interface. If not, the initial judgment condition is satisfied.
[0017] In some embodiments of the present application, the step of searching for the target historical conversation message set within the preset display period from the local database includes:
[0018] Detect whether there is a message sent in the chat room interface. If there is, obtain the earliest sending time of the message with the earliest sending time from the message table, and obtain multiple first historical conversation messages whose message sending time is less than or equal to the earliest sending time in the message table in ascending order based on the message sending time; among them, the first historical conversation message includes the message with the earliest sending time. If not, obtain multiple second historical conversation messages in ascending order from the message table according to the message sending time; among them, the target historical conversation message set includes each of the first historical conversation messages or each of the second historical conversation messages.
[0019] In some embodiments of the present application, determining whether the target historical conversation message is continuous with the conversation message content currently displayed in the chat room interface includes:
[0020] Obtain the current batch number of the message with the earliest sending time from the message table and the target batch number of the target historical conversation message with the earliest sending time in the target historical conversation message set.
[0021] Determine whether the current batch number is the same as the target batch number. If they are the same, the target historical conversation message set is continuous with the conversation message content currently displayed in the chat room interface. If they are not the same, the target historical conversation message set is not continuous with the conversation message content currently displayed in the chat room interface.
[0022] In some embodiments of the present application, when the type of the target conversation message is the historical conversation message type, obtaining the conversation message content of the type of the target conversation message within multiple preset display cycles from the server of the instant messaging software and storing it in the message table includes:
[0023] Detect whether there is a successfully sent message in the current chat room interface. If there is, obtain the sending time of the earliest sent message, and obtain multiple third historical conversation messages from the server whose message sending time is less than this sending time.
[0024] Obtain the first batch number of the successfully sent message from the message table, mark each of the third historical conversation messages with the first batch number, and store each of the third historical conversation messages in the message table.
[0025] If not, obtain multiple fourth historical conversation messages from the server in ascending order according to the message sending time, mark each of the fourth historical conversation messages with a second batch number, and store each of the fourth historical conversation messages in the message table.
[0026] In some embodiments of the present application, when the type of the target conversation message is the offline conversation type or the new conversation type, obtaining the conversation message content of the type of the target conversation message in multiple preset display periods from the server of the instant messaging software according to the type of the target conversation message and storing it in the message table includes:
[0027] When sequentially and positively obtaining multiple offline conversation messages or multiple new conversation messages from the server according to the message sending time, each of the offline conversation messages or each of the new conversation messages is marked with a third batch number and stored in the message table.
[0028] A second aspect of the present application provides an instant messaging message acquisition and synchronization device, which includes:
[0029] A judgment condition selection module, configured to select a corresponding initial judgment condition according to the type of the target conversation message requested by the user in the chat room interface of the instant messaging software;
[0030] A chat data acquisition and synchronization module, configured to, if the initial judgment condition can be satisfied, retrieve the target conversation message within a preset display period from the local database by using the same data acquisition and synchronization method, and display the retrieved target conversation message in the chat room interface; the local database includes a message table; wherein, the data acquisition and synchronization method includes:
[0031] A server message acquisition module, configured to obtain the conversation message content of the type of the target conversation message in multiple preset display periods from the server of the instant messaging software according to the type of the target conversation message and store it in the message table.
[0032] A third aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the instant messaging message acquisition and synchronization method described in the first aspect above is implemented.
[0033] A fourth aspect of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the instant messaging message acquisition and synchronization method described in the first aspect above is implemented.
[0034] The present application provides a method and apparatus for obtaining and synchronizing instant messaging messages. The method includes: selecting a corresponding initial judgment condition according to the type of target conversation messages requested by the user in the chat room interface of the instant messaging software; if the initial judgment condition can be satisfied, the target conversation messages within a preset display period are retrieved from the local database by using the same data acquisition and synchronization method, and the retrieved message content is displayed in the chat room interface; the data acquisition and synchronization method includes: obtaining the conversation message content of the type of target conversation messages within multiple preset display periods from the server according to the type of target conversation messages and storing them in the local database. By using the same data acquisition and synchronization method, the problem that different solutions are adopted for obtaining historical messages, new messages, and offline messages in the prior art can be solved, thereby effectively simplifying the storage logic of message data and improving the efficiency of message maintenance.
[0035] Additional advantages, objects, and features of the present application will be partly described below, and will partly become apparent to those of ordinary skill in the art after studying the following parts, or may be learned from the practice of the present application. The objects and other advantages of the present application can be realized and obtained by the structure specifically pointed out in the specification and the drawings.
[0036] Those skilled in the art will understand that the objects and advantages that can be achieved by the present application are not limited to the above specifically described, and the above and other objects that the present application can achieve will be more clearly understood according to the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application, and do not limit the present application. The components in the drawings are not drawn to scale, but are only for showing the principles of the present application. For the convenience of showing and describing some parts of the present application, the corresponding parts in the drawings may be enlarged, that is, may become larger relative to other components in the exemplary device actually manufactured according to the present application. In the drawings:
[0038] Figure 1 is a schematic flowchart of the method for obtaining and synchronizing instant messaging messages in an embodiment of the present application.
[0039] Figure 2 is a schematic structural diagram of the apparatus for obtaining and synchronizing instant messaging messages in another embodiment of the present application.
[0040] Figure 3 is a schematic flowchart of the process of pulling down and loading new messages or historical messages in another embodiment of the present application.
[0041] Figure 4Schematic diagram of the process for obtaining the next screen data locally on a mobile device in another embodiment of the present application.
[0042] Figure 5 Schematic diagram of the process for determining the continuity of the next screen data in another embodiment of the present application.
[0043] Figure 6 Schematic diagram of the process for requesting the subsequent N screen data from the backend and storing it in the database in another embodiment of the present application.
[0044] Figure 7 Schematic diagram of the process for maintaining the continuity of new message sending and receiving in another embodiment of the present application.
[0045] Figure 8 Schematic diagram of the process for maintaining the batch numbers of messages to be sent and received in another embodiment of the present application. Detailed implementation manners
[0046] To make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below in conjunction with the implementation manners and the accompanying drawings. Herein, the illustrative implementation manners of the present application and their descriptions are used to explain the present application, but are not intended to limit the present application.
[0047] Herein, it should also be noted that in order to avoid obscuring the present application due to unnecessary details, only the structures and / or processing steps closely related to the solution of the present application are shown in the drawings, while other details less related to the present application are omitted.
[0048] It should be emphasized that the term "including / containing" when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.
[0049] Herein, it should also be noted that if not otherwise specified, the term "connection" in this article can refer not only to a direct connection, but also to an indirect connection with an intermediate.
[0050] In the following, embodiments of the present application will be described with reference to the accompanying drawings. In the drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0051] Specifically, it will be described in detail through the following embodiments.
[0052] The embodiments of the present application provide an instant messaging message acquisition and synchronization method that can be executed by an instant messaging message acquisition and synchronization device or a mobile client. Refer to Figure 1 , the instant messaging message acquisition and synchronization method specifically includes the following content:
[0053] Step 110: Select a corresponding initial judgment condition according to the type of the target conversation message requested by the user in the chat room interface of the instant messaging software.
[0054] Among them, when the type of the target conversation message is a historical conversation type, Step 110 includes:
[0055] Step 111: If it is detected that the user performs a pull-down operation in the chat room interface to obtain historical chat messages, search for the target historical conversation message set within the preset display period from the local database.
[0056] Step 112: Determine whether there is continuity between the target historical conversation message set and the message content currently displayed in the chat room interface. If not, the initial judgment condition is satisfied.
[0057] Specifically, referring to Figure 3 , when the mobile client detects that the user performs a pull-down operation in the chat room interface to obtain a target conversation message of the historical conversation type (i.e., the user pulls down to query historical messages in Figure 3 ), search for the target historical conversation message set within the preset display period from the local database (i.e., locally obtain the next screen of data in Figure 3 ); determine whether there is continuity between the target historical conversation message set and the message content currently displayed in the chat room interface (i.e., determine the continuity of the next screen of data in Figure 3 ). If not, the initial judgment condition is satisfied.
[0058] When the type of the target conversation message is a non-historical conversation type, Step 110 includes:
[0059] Step 113: Determine whether the chat room has requested the content of the conversation message of the non-historical conversation type after the user enters the chat room corresponding to the chat room interface. If not, the initial judgment condition is satisfied.
[0060] Specifically, referring to Figure 3 , after the user enters the chat room corresponding to the chat room interface (i.e., the user enters the chat room in Figure 3 ), the mobile client determines whether the chat room has requested the content of the conversation message of the non-historical conversation type (i.e., whether it has requested the latest message in Figure 3 ). If not, the initial judgment condition is satisfied.
[0061] Among them, the non-historical conversation type includes: the offline conversation type and the new conversation type.
[0062] Step 120: If the initial judgment condition can be satisfied, retrieve the target conversation messages within a preset display period from the local database using the same data acquisition and synchronization method, and display the retrieved target conversation messages in the chat room interface; the local database includes a message table; wherein, the data acquisition and synchronization method includes the following Step 130;
[0063] Step 130: Obtain the conversation message content of the type of the target conversation message within multiple preset display periods from the server of the instant messaging software according to the type of the target conversation message and store it in the message table.
[0064] Specifically, the mobile client first selects a corresponding initial judgment condition according to the type of the target conversation message requested by the user in the chat room interface of the instant messaging software; if the initial judgment condition can be satisfied, retrieve the target conversation messages within a preset display period from the local database using the same data acquisition and synchronization method, and display the retrieved target conversation messages in the chat room interface, so as to effectively simplify the storage logic of message data and improve the efficiency of message maintenance.
[0065] Among them, the data acquisition and synchronization method includes: obtaining the conversation message content of the type of the target conversation message within multiple preset display periods from the server of the instant messaging software according to the type of the target conversation message and storing it in the local database, and the preset display period can take 20 chat messages.
[0066] To ensure the integrity of historical message data retrieved from the local database, Step 111 includes:
[0067] Detect whether there is a sent message in the chat room interface. If so, obtain the earliest sending time of the message with the earliest sending time in the message table, and obtain multiple first historical conversation messages whose message sending time is less than or equal to the earliest sending time from the message table in ascending order based on the message sending time; wherein, the first historical conversation message includes the message with the earliest sending time; if not, obtain multiple second historical conversation messages from the message table in ascending order according to the message sending time; wherein, the target historical conversation message set includes each of the first historical conversation messages or each of the second historical conversation messages.
[0068] Specifically, refer to Figure 4 , the mobile client first detects whether there is a sent message in the chat room interface. If so, obtain the earliest sending time of the message with the earliest sending time in the message table (that is Figure 4(Obtain the sending time of the latest message displayed in the chat room), record the time x as the earliest sending time, and obtain multiple first historical conversation messages whose message sending times are less than or equal to the earliest sending time in ascending order from the message table based on the message sending time (such as Figure 4 in the query message table: Obtain in ascending order of the message sending time, one screen of data (such as 20 pieces) whose message sending time is less than or equal to time X); if not, record the time x as infinity, and obtain multiple second historical conversation messages in ascending order from the message table according to the message sending time (such as Figure 4 in the query message table: Obtain in ascending order of the message sending time, one screen of data (such as 20 pieces) whose message sending time is less than or equal to time X)), so as to ensure the integrity of obtaining historical message data from the local database.
[0069] Among them, the first historical conversation message includes the message with the earliest sending time, and the target historical conversation message set includes each first historical conversation message or each second historical conversation message.
[0070] In order to effectively determine whether the target historical conversation message set is continuous with the conversation message content currently displayed in the chat room interface, step 112 includes:
[0071] Obtain the current batch number of the message with the earliest sending time from the message table and the target batch number of the target historical conversation message with the earliest sending time in the target historical conversation message set;
[0072] Judge whether the current batch number is the same as the target batch number. If they are the same, the target historical conversation message set is continuous with the conversation message content currently displayed in the chat room interface; if not, the target historical conversation message set is not continuous with the conversation message content currently displayed in the chat room interface.
[0073] Specifically, referring to Figure 5 , the mobile client obtains the current batch number of the message with the earliest sending time from the message table (that is, Figure 5 the batch number of obtaining the last message in Figure 5 and the target batch number of the target historical conversation message with the earliest sending time in the target historical conversation message set (that is,
[0074] the batch number of obtaining the first message in Figure 5whether the batch numbers of the two messages in are the same. If they are the same, the target historical conversation message set is continuous with the conversation message content currently displayed in the chat room interface; if they are different, the target historical conversation message set is not continuous with the conversation message content currently displayed in the chat room interface, so as to effectively determine whether the target historical conversation message set is continuous with the conversation message content currently displayed in the chat room interface.
[0075] To effectively make the target message acquisition logics of different types the same and synchronize different types of target messages to the local database, when the type of the target conversation message is the historical conversation message type, step 130 includes:
[0076] Detect whether there is a message with a successful send in the current chat room interface. If there is, obtain the send time of the earliest sent message among them, and obtain multiple third historical conversation messages from the server whose message send time is less than this send time;
[0077] Obtain the first batch number of the successfully sent message from the message table, mark each of the third historical conversation messages with the first batch number, and store each of the third historical conversation messages in the message table;
[0078] If not, obtain multiple fourth historical conversation messages from the server in ascending order according to the message send time, mark each of the fourth historical conversation messages with a second batch number, and store each of the fourth historical conversation messages in the message table.
[0079] Specifically, see Figure 6 , the mobile client first detects whether there is a message with a successful send in the current chat room interface. If there is, obtain the send time of the earliest sent message among them (i.e., Figure 6 the latest successfully sent message displayed in the chat room obtained in , whether there is the latest message, and record the send time of the latest message as x), and obtain multiple third historical conversation messages from the server whose message send time is less than this send time (i.e., Figure 6 implemented in to query the message set of this user in this chat room whose message send time is less than time x in ascending order of message send time); obtain the first batch number of the successfully sent message from the message table (i.e., Figure 6 record the batch number of the latest message as batch number Y in ), mark each of the third historical conversation messages with the first batch number, and store each of the third historical conversation messages in the message table (i.e., Figure 6 implemented in to change the batch numbers of the query message set to Y and store the query messages in the database); if not, obtain multiple fourth historical conversation messages from the server in ascending order according to the message send time (i.e., Figure 6Whether there is a latest message implemented in sequence, record the time x as infinity, record the batch number Y = the batch number of the message to be sent and received, and in ascending order of the message sending time, query the set of messages of the user in the chat room whose message sending time is less than time x), mark each fourth historical conversation message with the second batch number and store each fourth historical conversation message in the message table (i.e., Figure 6 in sequence, change the batch numbers of the query message set to Y and store the query messages in the database), so as to effectively make the acquisition logics of different types of target messages the same and synchronize different types of target messages to the local database.
[0080] To effectively make the acquisition logics of different types of target messages the same and synchronize different types of target messages to the local database, when the type of the target conversation message is an offline conversation type or a new conversation type, step 130 includes:
[0081] When obtaining multiple offline conversation messages or multiple new conversation messages from the server in ascending order according to the message sending time, mark each of the offline conversation messages or each of the new conversation messages with the third batch number and store each of the offline conversation messages or each of the new conversation messages in the message table.
[0082] Specifically, when the mobile client obtains multiple offline conversation messages or multiple new conversation messages from the server in ascending order according to the message sending time, mark each offline conversation message or each new conversation message with the third batch number and store each offline conversation message or each new conversation message in the message table, so as to effectively make the acquisition logics of different types of target messages the same and synchronize different types of target messages to the local database.
[0083] Since the continuity of historical messages is managed by the background in the prior art and the mobile device does not have the determination condition and needs to consult the backend, each time the user sends a new message, it will cause the user to consult the backend about the continuity when re-entering the chat room, wasting backend resources. Therefore, a method for the mobile terminal to determine the continuity of new messages is proposed in the second aspect of the present application. The method includes:
[0084] Step 210: If the user sends a new message or receives the new message, mark the new message with the batch number to be sent and received and store the new message in the message table; wherein, if the batch number to be sent and received does not exist, randomly generate the batch number to be sent and received.
[0085] Step 220: If it is detected that the user exits the application or the long connection where the user is located is disconnected, reset the batch number to be sent and received.
[0086] Specifically, see Figure 7, if the user sends a new message or receives the new message, the mobile client marks the new message with a batch number for sending and receiving and stores the new message in the message table; see Figure 8 , if it is detected that the user exits the application or the long connection where the user is located is disconnected, the batch number for sending and receiving is reset, so that the continuity of new messages can be effectively maintained on the mobile side.
[0087] Among them, see Figure 7 , if the batch number for sending and receiving does not exist, the batch number for sending and receiving is randomly generated.
[0088] From a software level, the present application also provides an instant messaging message acquisition and synchronization device for executing all or part of the instant messaging message acquisition and synchronization method described above, see Figure 2 , the instant messaging message acquisition and synchronization device specifically includes the following content:
[0089] A judgment condition selection module 10, configured to select a corresponding initial judgment condition according to the type of the target conversation message requested by the user in the chat room interface of the instant messaging software.
[0090] A chat data acquisition and synchronization module 20, configured to, if the initial judgment condition can be satisfied, retrieve target conversation messages within a preset display period from the local database in the same data acquisition and synchronization manner and display the retrieved target conversation messages in the chat room interface; the local database includes a message table; among them, the data acquisition and synchronization manner includes:
[0091] A server message acquisition module 30, configured to acquire the conversation message content of the type of the target conversation message within a plurality of the preset display periods from the server of the instant messaging software according to the type of the target conversation message and store it in the message table.
[0092] The embodiment of the instant messaging message acquisition and synchronization device provided by the present application can specifically be used to execute the processing flow of the embodiment of the instant messaging message acquisition and synchronization method in the above embodiment, and its functions will not be described in detail here. Reference can be made to the detailed description of the embodiment of the instant messaging message acquisition and synchronization method above.
[0093] The present application provides a method and apparatus for obtaining and synchronizing instant messaging messages. The method executed by the apparatus includes: selecting a corresponding initial judgment condition according to the type of target conversation message requested by the user in the chat room interface of the instant messaging software; if the initial judgment condition can be satisfied, the target conversation messages within a preset display period are retrieved from the local database by using the same data acquisition and synchronization method, and the retrieved message content is displayed in the chat room interface; the data acquisition and synchronization method includes: obtaining the conversation message content of the type of the target conversation message within multiple preset display periods from the server and storing it in the local database. By using the same data acquisition and synchronization method, the problem that different solutions are adopted for obtaining historical messages, new messages, and offline messages in the prior art can be solved, so that the storage logic of message data can be effectively simplified and the efficiency of message maintenance can be improved.
[0094] An embodiment of the present application further provides an electronic device, such as a central server. The electronic device may include a processor, a memory, a receiver, and a transmitter. The processor is used to execute the method for obtaining and synchronizing instant messaging messages mentioned in the above embodiment. The processor and the memory may be connected through a bus or other means. Taking the connection through the bus as an example, the receiver can be connected to the processor and the memory in a wired or wireless manner.
[0095] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., or a combination of the above types of chips.
[0096] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as program instructions / modules corresponding to the method for obtaining and synchronizing instant messaging messages in the embodiment of the present application. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions, and modules stored in the memory, that is, implements the method for obtaining and synchronizing instant messaging messages in the above method embodiment.
[0097] The memory may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created by the processor and the like. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0098] The one or more modules are stored in the memory and, when executed by the processor, perform the method for obtaining and synchronizing instant messaging messages in the embodiments.
[0099] In some embodiments of the present application, the user equipment may include a processor, a memory, and a transceiver unit. The transceiver unit may include a receiver and a transmitter. The processor, the memory, the receiver, and the transmitter may be connected through a bus system. The memory is used to store computer instructions, and the processor is used to execute the computer instructions stored in the memory to control the transceiver unit to send and receive signals.
[0100] As an implementation manner, the functions of the receiver and the transmitter in the present application may be considered to be implemented through a transceiver circuit or a dedicated transceiver chip, and the processor may be considered to be implemented through a dedicated processing chip, a processing circuit, or a general-purpose chip.
[0101] As another implementation manner, it may be considered to use a general-purpose computer to implement the server provided in the embodiments of the present application. That is, the program codes for implementing the functions of the processor, the receiver, and the transmitter are stored in the memory, and the general-purpose processor implements the functions of the processor, the receiver, and the transmitter by executing the codes in the memory.
[0102] The embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the foregoing method for obtaining and synchronizing instant messaging messages are implemented. The computer-readable storage medium may be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium well-known in the technical field.
[0103] Those of ordinary skill in the art should understand that the various exemplary components, systems, and methods described in connection with the embodiments disclosed herein can be implemented in hardware, software, or a combination of both. Specifically, whether to implement in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a functional card, and so on. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium or transmitted via a data signal carried in a carrier wave over a transmission medium or a communication link.
[0104] It should be clear that this application is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and illustrated as examples. However, the method process of this application is not limited to the specific steps described and illustrated. Those skilled in the art can make various changes, modifications, and additions, or change the order between steps after understanding the spirit of this application.
[0105] In this application, the features described and / or illustrated for one embodiment can be used in the same or a similar manner in one or more other embodiments, and / or combined with the features of other embodiments or replace the features of other embodiments.
[0106] The above are only the preferred embodiments of this application and are not used to limit this application. For those skilled in the art, various changes and variations can be made to the embodiments of this application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included within the protection scope of this application.
Claims
1. A method for obtaining and synchronizing instant messaging messages, characterized in that, Including: Select corresponding initial judgment conditions according to the type of target conversation message requested by the user in the chat room interface of the instant messaging software; If the initial judgment conditions can be satisfied, retrieve the target conversation messages within a preset display period from the local database using the same data acquisition and synchronization method, and display the retrieved target conversation messages in the chat room interface; The local database includes a message table; Wherein, the data acquisition and synchronization method includes: acquiring the conversation message content of the type of the target conversation message within multiple preset display periods from the server of the instant messaging software according to the type of the target conversation message and storing it in the message table; If the type of the target conversation message is: historical conversation type; correspondingly, the selecting corresponding initial judgment conditions according to the type of the target conversation message requested by the user in the chat room interface of the instant messaging software includes: If it is detected that the user performs a pull-down operation in the chat room interface to obtain historical chat messages, search for the target historical conversation message set within the preset display period from the local database; Judge whether there is continuity between the target historical conversation message set and the message content currently displayed in the chat room interface. If not, the initial judgment conditions are satisfied; If the type of the target conversation message is: non-historical conversation type; the non-historical conversation type includes: offline conversation type and new conversation type; correspondingly, the selecting corresponding initial judgment conditions according to the type of the target conversation message requested by the user in the chat room interface of the instant messaging software includes: Judge whether the chat room has requested the conversation message content of the non-historical conversation type after the user enters the chat room corresponding to the chat room interface. If not, the initial judgment conditions are satisfied.
2. The method for obtaining and synchronizing instant messaging messages according to claim 1, wherein After the retrieved target conversation messages are displayed in the chat room interface, it further includes: If the user sends a new message or receives the new message, mark the new message with a to-be-sent / received batch number and store the new message in the message table; wherein, if the to-be-sent / received batch number does not exist, randomly generate the to-be-sent / received batch number; If it is detected that the user exits the application or the long connection where the user is located is disconnected, reset the to-be-sent / received batch number.
3. The method for obtaining and synchronizing instant messaging messages according to claim 1, characterized in that, The searching for the target historical conversation message set within the preset display period from the local database includes: Detect whether there is a sent message in the chat room interface. If there is, obtain the earliest sending time of the message with the earliest sending time from the message table, and obtain multiple first historical conversation messages whose message sending time is less than or equal to the earliest sending time in ascending order based on the message sending time from the message table; wherein, the first historical conversation message includes the message with the earliest sending time; if not, obtain multiple second historical conversation messages in ascending order according to the message sending time from the message table; wherein, the target historical conversation message set includes each of the first historical conversation messages or each of the second historical conversation messages.
4. The method for obtaining and synchronizing instant messaging messages according to claim 3, wherein The determining whether the target historical conversation message is continuous with the conversation message content currently displayed in the chat room interface includes: Obtaining from the message table the current batch number of the earliest sent message and the target batch number of the earliest sent target historical conversation message in the target historical conversation message set; Determine whether the current batch number is the same as the target batch number. If so, the target historical conversation message set is continuous with the conversation message content currently displayed in the chat room interface. If not, the target historical conversation message set is discontinuous with the conversation message content currently displayed in the chat room interface.
5. The method for obtaining and synchronizing instant messaging messages according to claim 1, wherein When the type of the target conversation message is the type of the historical conversation message, obtaining, from the server of the instant messaging software, conversation message contents of the type of the target conversation message within a plurality of preset display periods and storing them in the message table according to the type of the target conversation message includes: Detecting whether there are any successfully sent messages in the current chat room interface, and if so, obtaining the sending time of the earliest message therein, and obtaining from the server a plurality of third historical conversation messages whose sending times are less than the sending time; obtaining a first batch number of the successfully sent message from the message table, marking each of the third historical conversation messages with the first batch number, and storing each of the third historical conversation messages in the message table; If not, multiple fourth historical conversation messages are obtained from the server in positive order according to the message sending time, each of the fourth historical conversation messages is marked with a second batch number, and each of the fourth historical conversation messages is stored in the message table.
6. The method for obtaining and synchronizing instant messaging messages according to claim 1, wherein When the type of the target conversation message is the offline conversation type or the new conversation type, obtaining conversation message contents of the target conversation message type within a plurality of preset display periods from the server of the instant messaging software according to the type of the target conversation message and storing the contents in the message table includes: When multiple offline conversation messages or multiple new conversation messages are obtained from the server in positive order according to the message sending time, each offline conversation message or each new conversation message is marked with a third batch number and each offline conversation message or each new conversation message is stored in the message table.
7. An instant messaging message acquisition and synchronization device, characterized in that, include: A judgment condition selection module is used to select a corresponding initial judgment condition according to the type of target conversation message requested by the user in the chat room interface of the instant messaging software; a chat data acquisition and synchronization module configured to retrieve target conversation messages within a preset display period from a local database using the same data acquisition and synchronization method if the initial judgment condition is met, and to display the retrieved target conversation messages in the chat room interface; The local database includes a message table; wherein the data acquisition and synchronization method includes: A server message acquisition module, configured to acquire the conversation message content of the type of the target conversation message within a plurality of the preset display periods from the server of the instant messaging software according to the type of the target conversation message, and store the content in the message table; If the type of the target conversation message is: a historical conversation type; correspondingly, the initial judgment conditions selected according to the type of the target conversation message requested by the user in the chat room interface of the instant messaging software include: If it is detected that the user performs a pull-down operation in the chat room interface to obtain historical chat messages, search for a target historical conversation message set within the preset display period from the local database; Determine whether the target historical conversation message set is continuous with the message content currently displayed in the chat room interface. If not, the initial judgment condition is satisfied; If the type of the target conversation message is: a non-historical conversation type; the non-historical conversation type includes: an offline conversation type and a new conversation type; correspondingly, the initial judgment conditions selected according to the type of the target conversation message requested by the user in the chat room interface of the instant messaging software include: Determine whether the chat room has requested the conversation message content of the non-historical conversation type after the user enters the chat room corresponding to the chat room interface. If not, the initial judgment condition is satisfied.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method for acquiring and synchronizing instant messaging messages according to any one of claims 1 to 6.
Citation Information
Patent Citations
Message synchronization method and device, computer device and computer readable storage medium
CN110365739A
Manjob instant messaging method based on Internet technology application and architecture thereof
CN114500422A