Method and device for instant messaging client to acquire continuous messages
By implementing offline message pulling and local database management in the instant messaging client, it solves the possible message loss problem of users who have not logged in for a long time, reduces server pressure, and ensures data continuity.
Patent Information
- Application Number
- CN202411970753.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-12-30
AI Technical Summary
In instant messaging applications, users who have not logged in for a long time may lose some messages due to the server's offline message storage period limit, and the prior art has challenges in balancing server performance and cost.
By implementing offline message pull and local database management in the instant messaging client, the client pulls offline message records from the server when logging in and saves them to the local database. Judging whether there is a break-off interval based on offline time. If it exists, the message of the break-off interval will be pulled from the server and merged into the local database.
It effectively avoids message loss, reduces server pressure, improves data continuity and user experience, and balances server performance and cost.
Smart Images

Figure CN119743460A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method and device for an instant messaging client to obtain continuous messages. Background Art
[0002] When using the instant messaging function of the App, messages sent to offline users are called offline messages. Such messages will be temporarily stored in the server and forwarded to the user by the server after the user logs in. However, the core resources of the server are limited after all. Especially in application scenarios with a large number of users and a large amount of messages, a maximum storage period for offline messages is usually set. Once the user's offline time exceeds this period, the server will delete these expired messages. At this time, after the user logs in, the server will only actively send messages within the storage period. For the deleted parts, the user cannot receive them, which often causes message loss.
[0003] Instant messaging software in office environments such as governments and enterprises often have more stringent requirements on data persistence. In order to save server core resources and reduce storage costs, offline messages that exceed the maximum storage period are usually transferred to relatively cheap, low-performance storage services. For the performance of the main server, if a user logs in after the maximum offline storage period, the transferred offline messages will not be actively pushed to the user, and the user needs to actively pull them from the server.
[0004] Some existing technologies number all messages, so that when users who have been offline for a long time log in and receive offline messages, they can check whether the sequence number of the earlier messages can be connected, and then know whether they need to actively pull offline messages that exceed the maximum storage time limit. However, each message will take up a little more storage resources, and the cumulative occupation of server storage space is very serious. Some existing technologies do not number messages, but require all users to actively pull messages once after logging in. Although this does not increase storage space, for most users who are often online, this fixed active pull action is redundant, which not only wastes time but also increases traffic costs.
[0005] Therefore, for enterprise applications that are message-sensitive and have complete message backups on the server side, users who have not logged in for a long time first need to know whether they have offline messages that have exceeded the maximum storage time limit and need to be actively retrieved. Otherwise, some messages may be lost (interrupted), causing serious impact on work communication. Secondly, product design should also consider how to balance server performance and cost, and try to avoid taking too long or having too high storage costs. Summary of the invention
[0006] In view of the above defects or deficiencies in the prior art, the present invention provides a method and device for an instant messaging client to obtain continuous messages, which can perfectly solve the above technical problems.
[0007] One aspect of the present invention provides a method for an instant messaging client to obtain continuous messages, comprising: Send a message to the server indicating that the client has logged in successfully; In response to the offline message pull notification returned by the server, pull the offline message record of the session from the server, the offline message record carries the session ID, a number of offline messages, a start time stamp of offline message pull and an end time stamp of offline message pull, the start time stamp of offline message pull and the end time stamp of offline message pull constitute a continuous time interval; save the offline message record to the local database; If the offline time of the client before this offline message pull does not exceed the maximum offline message storage time, the start timestamp of this offline message pull is connected with the end timestamp of the existing continuous time interval, and the continuous time interval of this offline message pull is merged with the existing continuous time interval into a new continuous time interval; if the offline time of the client before this offline message pull exceeds the maximum offline message storage time, there is a gap between the continuous time interval of this offline message pull and the existing continuous time interval on the time axis; When the client calls the historical message query interface, it queries the local database for qualified continuous historical messages according to the input parameters. If the qualified continuous historical messages are completely located in the continuous time interval, the continuous historical messages queried in the local database are directly returned to the user; if a part of the qualified continuous historical messages is located in the gap interval, the partial continuous historical messages located in the gap interval are pulled from the server, the partial continuous historical messages are updated to the local database, and the time interval covered by the partial continuous historical messages in the gap interval and the adjacent continuous time interval are merged, and the qualified continuous historical messages in the updated local database are returned to the user.
[0008] Another aspect of the present invention further provides a device for an instant messaging client to obtain continuous messages, comprising: A sending module is used to send a message of successful client login to the server; The offline message pulling module is used to pull the offline message record of the session from the server in response to the offline message pulling notification returned by the server, wherein the offline message record carries the session ID, a number of offline messages, a start time stamp of the offline message pulling, and an end time stamp of the offline message pulling, wherein the start time stamp of the offline message pulling and the end time stamp of the offline message pulling constitute a continuous time interval; and save the offline message record to the local database; The session timeline processing module is used to connect the start time stamp of the current offline message pull with the end time stamp of the existing continuous time interval if the offline time of the client before the current offline message pull does not exceed the maximum offline message storage time, and merge the continuous time interval of the current offline message pull with the existing continuous time interval into a new continuous time interval; if the offline time of the client before the current offline message pull exceeds the maximum offline message storage time, there is a gap between the continuous time interval of the current offline message pull and the existing continuous time interval on the timeline; The historical message query module is used to query the qualified continuous historical messages from the local database according to the input parameters when the client calls the historical message query interface. If the qualified continuous historical messages are completely located in the continuous time interval, the continuous historical messages queried in the local database are directly returned to the user; if a part of the qualified continuous historical messages are located in the gap interval, the part of the continuous historical messages located in the gap interval is pulled from the server, the part of the continuous historical messages is updated to the local database, and the time interval covered by the part of the continuous historical messages in the gap interval and the adjacent continuous time interval are merged, and the qualified continuous historical messages in the updated local database are returned to the user.
[0009] The present invention provides a method and device for an instant messaging client to obtain continuous messages, which has the following beneficial effects: (1) The message list returned by the server does not need to carry more information; (2) Compared with numbering each message, the message of the present invention only contains timestamp endpoints of a limited number of time intervals, and the disk space occupied will not increase year-on-year with the increase of message volume; (3) When a user requests to obtain continuous historical messages, in most cases, as long as the requested continuous historical messages are within a continuous time interval in the local database, there is no need to request the server to pull offline messages that exceed the maximum storage time limit, which significantly reduces the pressure on the server. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings: Figure 1 It is a flowchart of a method for an instant messaging client to obtain continuous messages provided by an embodiment of the present application; Figure 2 is a schematic diagram of continuous time intervals on a time axis provided by an embodiment of the present application; Figure 3 is a schematic diagram of merging two consecutive time intervals on a time axis provided by an embodiment of the present application; Figure 4 It is a schematic diagram of two continuous time intervals with a gap on the time axis provided by an embodiment of the present application; Figure 5 This is a schematic diagram of pulling historical messages of all interrupted intervals on a time axis provided by an embodiment of the present application; Figure 6 It is a schematic diagram of merging discontinuous time intervals and continuous time intervals on a time axis provided by an embodiment of the present application; Figure 7 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0011] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0012] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0013] It should be understood that although the terms first, second, third, etc. may be used to describe the acquisition modules in the embodiments of the present invention, the acquisition modules should not be limited to these terms. These terms are only used to distinguish the acquisition modules from each other.
[0014] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0015] It should be noted that the directional words such as "upper", "lower", "left", and "right" described in the embodiments of the present invention are described at the angles shown in the drawings and should not be understood as limiting the embodiments of the present invention. In addition, in the context, it should also be understood that when it is mentioned that an element is formed "on" or "under" another element, it can not only be formed directly "on" or "under" another element, but also be formed "on" or "under" another element indirectly through an intermediate element.
[0016] One embodiment of the present application provides a method for an instant messaging client to obtain continuous messages. Each time the client synchronizes messages with the server, an insert / merge operation is performed on the continuous time interval of the session message in the client's local database, thereby continuously supplementing the message records in the local database. When querying historical messages, by judging whether the queried continuous historical messages are completely located in the continuous time interval in the local database, it is judged whether the local database has the continuous historical messages required by the user. If the queried continuous historical messages are not completely located in the continuous time interval in the local database, the historical messages of the gap interval are pulled from the server to supplement the local database, thereby ensuring the continuity of the messages in the local database.
[0017] See also Figure 1 , the method of this embodiment includes the following steps: Step S101, sending a message to the server indicating that the client has logged in successfully.
[0018] For ease of understanding, the business model of the instant messaging client and server in this embodiment is first introduced. Specifically, when a session message sent by a client reaches the server in the uplink, it will carry the timestamp of this moment as the sending time. The server uses two methods to synchronize messages to the client: (1) Notification pull. When the client is disconnected or offline, it will receive offline messages forwarded by other clients through the server, or when the messages are dense in the online state, the server receives multiple messages sent by other clients in the session group within a processing cycle. In this embodiment, these are all referred to as offline messages. When the server confirms that the client is online, it will send a signal to notify the client to actively pull this batch of offline messages. When the client's offline time exceeds the longest storage period of offline messages, the server will delete this part of the expired offline messages and transfer them to a storage space with lower cost. The transferred offline messages will not be actively pushed to the user, and the user needs to pull them from the server. (2) Direct message sending. When the client is online, the server will push a single message received within a processing cycle to the client in the form of direct sending.
[0019] In addition to the above two message synchronization methods, the client of this embodiment can initiate a historical message query to the server at any time. The historical messages to be queried here must be continuous historical messages, that is, users often need to obtain continuous historical messages within a certain period of time in the past. If the historical messages are not continuous, it is meaningless to the user because the messages obtained by the user at this time are incomplete, which is not conducive to communication.
[0020] The implementation scenario of this step is that when the client changes from an offline state to a successfully logged-in state, the client will send a successful login signal / data / message to the server to make the server aware that the client has successfully logged in.
[0021] Step S102, in response to the offline message pull notification returned by the server, pull the offline message record of the session from the server, the offline message record carries the session ID, several offline messages, the start timestamp of the offline message pull and the end timestamp of the offline message pull, the start timestamp of the offline message pull and the end timestamp of the offline message pull constitute a continuous time interval; save the offline message record to the local database.
[0022] Specifically, after receiving the offline message pull notification returned by the server, the client pulls the offline message record of the conversation group or a single conversation from the server. The offline message record carries the conversation ID, several offline messages, the starting timestamp of the offline message pull and the ending timestamp of the offline message pull. Furthermore, the offline message record may also include a starting timestamp identifier and an ending timestamp identifier.
[0023] After receiving the pulled offline message record, the client saves the offline message in the offline message record to the local database, and saves the session ID, the start time stamp of the offline message pull, and the end time stamp of the offline message pull to the corresponding session table of the local database. The data structure of the session table of this embodiment is shown in Table 1:
[0024] Table 1 Session ID String Session ID Timestamp Integer The endpoint 13-bit timestamp of a continuous time interval represents year, month, day, hour, minute, and second. For example: 00:00:00.000:00, January 1, 1970 type Integer Timestamp type (0 for start point / 1 for end point) For example, when a user logs in to the client on the morning of 2024-12-13, he receives 20 messages from group A through notification pull, and carries the earliest pull time of this batch of messages, 2024-12-07 18:12:20.435, represented by the starting timestamp 1733548340435, and the latest pull time, 2024-12-13 08:46:35.947, represented by the ending timestamp 1734050795947, which means that these 20 messages are pulled by notification within the time period of the above starting timestamp and ending timestamp, and there are no other messages of this session during this period. Optionally, the 13-digit timestamp is an integer value formed by converting the year, month, day, hour, minute, and second into the number of seconds, and other representation methods can also be used.
[0025] See also Figure 2 ,The area between the start timestamp of offline message pulling and the end timestamp of offline message pulling constitutes a continuous time interval on the time axis. After the client receives the pulled offline message record, it stores the following two pieces of information in the session table of the database, see Table 2:
[0026] Table 2 Session ID Timestamp type Group_A 1733548340435 0 Group_A 1734050795947 1 Step S103: If the offline time of the client before the current offline message pull does not exceed the maximum offline message storage time, the starting time stamp of the current offline message pull is connected with the ending time stamp of the existing continuous time interval, and the continuous time interval of the current offline message pull is merged with the existing continuous time interval into a new continuous time interval; if the offline time of the client before the current offline message pull exceeds the maximum offline message storage time, there is a gap between the continuous time interval of the current offline message pull and the existing continuous time interval on the time axis.
[0027] Specifically, the offline status of the client before logging in is divided into two situations. One situation is that the offline time does not exceed the maximum offline message storage time, and all offline messages during the offline period can be pulled from the server; the other situation is that the offline time exceeds the maximum offline message storage time. At this time, some timed-out offline data is deleted and transferred, so it cannot be obtained by server notification and pulling. The user must actively pull such offline messages from the server.
[0028] If the client's offline time before this offline message pull does not exceed the maximum offline message storage time, the start timestamp of this offline message pull is connected to the end timestamp of the existing continuous time interval, and the continuous time interval of this offline message pull is merged with the existing continuous time interval into a new continuous time interval. In other words, since all offline messages can be directly pulled from the server, the start timestamp of this offline message pull is connected with the end timestamp of the previously existing continuous time interval, and the continuous time interval of this offline message pull and the existing continuous time interval are two uninterrupted continuous time intervals, so the two can be merged into a large continuous time interval.
[0029] The above operations can be further divided into the following two situations: First, if the client's offline time before this offline message pull does not exceed the maximum offline message storage time, and no direct message sent by the server is received between the two offline message pull operations, the starting timestamp of this offline message pull is connected with the ending timestamp of the previous offline message pull, and the continuous time interval of this offline message pull is merged with the continuous time interval of the previous offline message pull into a new continuous time interval.
[0030] Second, if the client receives a direct message sent by the server after the offline message pulling operation (that is, the client is always online after logging in), the direct message will be saved to the local database, and the sending time of the direct message and the end time stamp of the previous offline message pulling will form another continuous time interval, and then the other continuous time interval will be merged with the continuous time interval of the previous offline message pulling to form a new continuous time interval.
[0031] For example, after logging in, the client performs the first message synchronization. If the first message synchronization is a notification pull, when the next message synchronization is encountered, if it is also a notification pull, the starting point of the continuous time interval returned by the server will be connected to the end point of the previous continuous time interval, that is, the two endpoints are connected together. Figure 3 , at the time point 2024-12-1308:48:21.233, the pull notification from the server was received. The data pulled by the client contained the start timestamp 1734050795947 and the end timestamp 1734050901233, so the newly generated continuous time interval (the interval between 1734050795947 and 1734050901233) will be merged with the previous continuous time interval (the interval between 1733548340435 and 1734050795947) into a new continuous time interval (the interval between 1733548340435 and 1734050901233). Similarly, if the next message synchronization is a direct message from the server, the area between the end point of the previous continuous time interval and the sending time of the direct message will be used as a new continuous time interval, and then connected and merged with the existing continuous time interval.
[0032] If the client's offline time before this offline message pull exceeds the maximum offline message storage time, there will be a gap between the continuous time interval of this offline message pull and the existing continuous time interval on the time axis. This is because the server has deleted and transferred the offline messages that have exceeded the maximum offline message storage time, and can only notify the client to pull offline messages that have not exceeded the maximum offline message storage time. Therefore, the continuous time interval of this offline message pull cannot be connected with the previous continuous time interval. There is a gap between the two continuous time intervals. There may be offline messages in this gap, but they can no longer be obtained through notification pull.
[0033] For example, see Figure 4 . When the client is offline and exceeds the maximum offline message storage time, and then logs in again, for example, at 2024-12-25 17:22:43.526, assuming that the maximum offline message storage time is 7 days, then the result returned by the first notification pull after login, regardless of whether there is a message or not, will include the continuous time interval represented by this pull: starting timestamp 1734512400000 to end timestamp 1735118563526, which is the maximum offline message storage time of 7 days. So the following will be generated in the client's local database: Figure 4 The non-continuous time interval shown (the interval between 1734050901233 and 1734512400000) is also called the gap interval.
[0034] Step S104, when the client calls the historical message query interface, it queries the local database for qualified continuous historical messages according to the input parameters. If the qualified continuous historical messages are completely located in the continuous time interval, the continuous historical messages queried in the local database are directly returned to the user; if a part of the qualified continuous historical messages are located in the gap interval, the part of the continuous historical messages located in the gap interval is pulled from the server, the part of the continuous historical messages is updated to the local database, and the time interval covered by the part of the continuous historical messages in the gap interval and the adjacent continuous time interval are merged, and the qualified continuous historical messages in the updated local database are returned to the user.
[0035] Specifically, the multiple continuous time intervals representing the Group_A session in the session table of the client's local database form a message continuity confidence timeline. From this timeline, you can clearly know which time periods (intervals) have not been synchronized with the server. When the user needs to review the past historical conversations, the historical message query interface will be called. At this time, based on the input parameters (including but not limited to: starting timestamp, query timeline direction, and query message quantity), continuous historical messages are preferentially obtained from the local database.
[0036] If the continuous historical messages that meet the conditions are completely located in the continuous time interval, it means that the continuous historical messages that the user wants to obtain are completely present in the local database, or the messages in the local database are complete and continuous, at least no gaps are found at present, so the continuous historical messages can be directly returned to the user; If part of the qualified continuous historical messages is located in the gap interval, then the part of the continuous historical messages located in the gap interval is pulled from the server, the part of the continuous historical messages is updated to the local database, and the time interval covered by the part of the continuous historical messages in the gap interval and the adjacent continuous time interval are merged, and the qualified continuous historical messages in the updated local database are returned to the user. In fact, it can be divided into two cases: first, if the qualified continuous historical messages completely cover a certain gap interval (equal to the gap interval or larger than the gap interval), then all the historical messages in the gap interval are pulled from the server and updated to the local database, and the gap interval and the adjacent continuous time interval are merged; second, if the qualified continuous historical messages cover a part of a certain gap interval (smaller than the gap interval), then the part of the continuous historical messages located in the gap interval is pulled from the server and updated to the local database, and the part of the gap interval covered by the qualified continuous historical messages and the adjacent continuous time interval are merged.
[0037] For example, see Figure 5. The client calls the historical message query interface, takes 2024-12-18 20:00:00 as the query time starting point (timestamp 1734523200000), and pulls 10 consecutive historical messages to an earlier time (to the left of the timeline). The time span of these 10 consecutive historical messages covers the entire gap interval. When the client detects that there is a gap interval in the local database, it will automatically send a pull request to the server to pull all historical messages between 1734050901233 and 1734512400000 (the entire gap interval). These pulled historical messages will be stored in the client's local database to compensate for the missing messages in the local database during the gap interval. See Figure 6 , the gap interval in the local database (1734050901233 ~ 1734512400000) and the adjacent continuous time interval on the left (the interval between 1733548340435 and 1734050901233) and the adjacent continuous time interval on the right (the interval between 1734512400000 and 1735118563526) will also be merged into a new larger continuous time interval (the interval between 1733548340435 and 1735118563526), and at the same time, starting from 1734523200000, 10 consecutive messages will be returned to the user again. In this way, the client can get the historical messages without any gaps.
[0038] The method provided in this embodiment, although the offline messages pulled contain a small amount of time endpoint data and will increase the storage capacity to a certain extent, the storage capacity increases very little and is relatively constant, and will not increase linearly with the increase in the number of messages. For example, the prior art adds a sequence number to each message, and 1 million messages will increase the storage space of 1 million sequence numbers. This embodiment is a way to record continuous time intervals. This continuous time interval will continue to merge as the number of messages increases. If all are merged in the end, then no matter how many messages there are, only one pair of starting point and end point will be recorded, so the storage resources occupied are very small. In addition, when a user requests to obtain continuous historical messages, there is no need to request the server to pull offline messages that exceed the maximum storage time limit. The relevant historical messages can be obtained from the local database, which significantly reduces the pressure on the server.
[0039] See also Figure 7 Another embodiment of the present invention further provides a device 200 for an instant messaging client to obtain continuous messages, comprising a sending module 201, an offline message pulling module 202, a session timeline processing module 203 and a historical message query module 204. The device 200 can execute the method for an instant messaging client to obtain continuous messages in the method embodiment.
[0040] Specifically, the device 200 for obtaining continuous messages by an instant messaging client includes: A sending module 201 is used to send a message indicating that the client has successfully logged in to the server; The offline message pulling module 202 is used to pull the offline message record of the session from the server in response to the offline message pulling notification returned by the server, wherein the offline message record carries the session ID, a number of offline messages, a start time stamp of the offline message pulling, and an end time stamp of the offline message pulling, wherein the start time stamp of the offline message pulling and the end time stamp of the offline message pulling constitute a continuous time interval; and save the offline message record to the local database; The session timeline processing module 203 is used to connect the start time stamp of the current offline message pull with the end time stamp of the existing continuous time interval if the offline time of the client before the current offline message pull does not exceed the maximum offline message storage time, and merge the continuous time interval of the current offline message pull with the existing continuous time interval into a new continuous time interval; if the offline time of the client before the current offline message pull exceeds the maximum offline message storage time, there is a gap between the continuous time interval of the current offline message pull and the existing continuous time interval on the timeline; The historical message query module 204 is used to query the qualified continuous historical messages from the local database according to the input parameters when the client calls the historical message query interface. If the qualified continuous historical messages are completely located in the continuous time interval, the continuous historical messages queried in the local database are directly returned to the user; if a part of the qualified continuous historical messages are located in the gap interval, the part of the continuous historical messages located in the gap interval is pulled from the server, the part of the continuous historical messages is updated to the local database, and the time interval covered by the part of the continuous historical messages in the gap interval and the adjacent continuous time interval are merged, and the qualified continuous historical messages in the updated local database are returned to the user.
[0041] It should be noted that the device 200 for obtaining continuous messages by an instant messaging client provided in this embodiment corresponds to a technical solution that can be used to execute various method embodiments, and its implementation principle and technical effect are similar to those of the method, which will not be repeated here.
[0042] The above description is only a preferred embodiment of the present invention. Those skilled in the art should understand that the scope of disclosure involved in the present invention is not limited to the technical solution formed by a specific combination of the above technical features, but also should cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) to form a technical solution.
Claims
1. A method for an instant messaging client to obtain continuous messages, characterized in that include: Send a message to the server indicating that the client has logged in successfully; In response to the offline message pull notification returned by the server, pull the offline message record of the session from the server, the offline message record carries the session ID, a number of offline messages, a start time stamp of offline message pull and an end time stamp of offline message pull, the start time stamp of offline message pull and the end time stamp of offline message pull constitute a continuous time interval; save the offline message record to the local database; If the offline time of the client before this offline message pull does not exceed the maximum offline message storage time, the start timestamp of this offline message pull is connected with the end timestamp of the existing continuous time interval, and the continuous time interval of this offline message pull is merged with the existing continuous time interval into a new continuous time interval; if the offline time of the client before this offline message pull exceeds the maximum offline message storage time, there is a gap between the continuous time interval of this offline message pull and the existing continuous time interval on the time axis; When the client calls the historical message query interface, it queries the local database for qualified continuous historical messages according to the input parameters. If the qualified continuous historical messages are completely located in the continuous time interval, the continuous historical messages queried in the local database are directly returned to the user; if a part of the qualified continuous historical messages is located in the gap interval, the partial continuous historical messages located in the gap interval are pulled from the server, the partial continuous historical messages are updated to the local database, and the time interval covered by the partial continuous historical messages in the gap interval and the adjacent continuous time interval are merged, and the qualified continuous historical messages in the updated local database are returned to the user.
2. A method for obtaining continuous messages by an instant messaging client according to claim 1, characterized in that: Also includes: If the client's offline time before this offline message pull does not exceed the maximum offline message storage time, and no direct message sent by the server is received between the two offline message pull operations, the starting timestamp of this offline message pull is connected with the ending timestamp of the previous offline message pull, and the continuous time interval of this offline message pull is merged with the continuous time interval of the previous offline message pull into a new continuous time interval.
3. The method for obtaining continuous messages by an instant messaging client according to claim 1, characterized in that: Also includes: If the client receives a direct message sent by the server after the offline message pulling operation, the direct message will be saved in the local database, and the sending time of the direct message and the end time stamp of the previous offline message pulling will form another continuous time interval, and then the other continuous time interval will be merged with the continuous time interval of the previous offline message pulling to form a new continuous time interval.
4. The method for obtaining continuous messages by an instant messaging client according to claim 1, characterized in that: If part of the continuous historical messages that meet the conditions are located in the gap interval, the steps of pulling part of the continuous historical messages located in the gap interval from the server, updating the part of the continuous historical messages to the local database, and merging the time interval covered by the part of the continuous historical messages in the gap interval with the adjacent continuous time interval include: If the qualified continuous historical messages completely cover a certain gap interval, all historical messages in the gap interval are pulled from the server and updated to the local database, and the gap interval and the adjacent continuous time interval are merged; Furthermore, if the qualified continuous historical messages cover a part of a certain gap interval, the part of continuous historical messages in the gap interval is pulled from the server and updated to the local database, and the part of the gap interval is merged with the adjacent continuous time interval.
5. The method for obtaining continuous messages by an instant messaging client according to claim 1, characterized in that: The input parameters include the start timestamp of the query, the time axis direction of the query, and the number of messages queried.
6. A device for obtaining continuous messages by an instant messaging client, characterized in that include: A sending module is used to send a message of successful client login to the server; The offline message pulling module is used to pull the offline message record of the session from the server in response to the offline message pulling notification returned by the server, wherein the offline message record carries the session ID, a number of offline messages, a start time stamp of the offline message pulling, and an end time stamp of the offline message pulling, wherein the start time stamp of the offline message pulling and the end time stamp of the offline message pulling constitute a continuous time interval; and save the offline message record to the local database; The session timeline processing module is used to connect the start time stamp of the current offline message pull with the end time stamp of the existing continuous time interval if the offline time of the client before the current offline message pull does not exceed the maximum offline message storage time, and merge the continuous time interval of the current offline message pull with the existing continuous time interval into a new continuous time interval; if the offline time of the client before the current offline message pull exceeds the maximum offline message storage time, there is a gap between the continuous time interval of the current offline message pull and the existing continuous time interval on the timeline; The historical message query module is used to query the qualified continuous historical messages from the local database according to the input parameters when the client calls the historical message query interface. If the qualified continuous historical messages are completely located in the continuous time interval, the continuous historical messages queried in the local database are directly returned to the user; if a part of the qualified continuous historical messages are located in the gap interval, the part of the continuous historical messages located in the gap interval is pulled from the server, the part of the continuous historical messages is updated to the local database, and the time interval covered by the part of the continuous historical messages in the gap interval and the adjacent continuous time interval are merged, and the qualified continuous historical messages in the updated local database are returned to the user.
7. The device for obtaining continuous messages by an instant messaging client according to claim 6, characterized in that: The session timeline processing module is also used for: If the client's offline time before this offline message pull does not exceed the maximum offline message storage time, and no direct message sent by the server is received between the two offline message pull operations, the starting timestamp of this offline message pull is connected with the ending timestamp of the previous offline message pull, and the continuous time interval of this offline message pull is merged with the continuous time interval of the previous offline message pull into a new continuous time interval.
8. The device for obtaining continuous messages by an instant messaging client according to claim 6, characterized in that: The session timeline processing module is also used for: If the client receives a direct message sent by the server after the offline message pulling operation, the direct message will be saved in the local database, and the sending time of the direct message and the end time stamp of the previous offline message pulling will form another continuous time interval, and then the other continuous time interval will be merged with the continuous time interval of the previous offline message pulling to form a new continuous time interval.
9. The device for obtaining continuous messages by an instant messaging client according to claim 6, characterized in that: The historical message query module is also used for: If the qualified continuous historical messages completely cover a certain gap interval, all historical messages in the gap interval are pulled from the server and updated to the local database, and the gap interval and the adjacent continuous time interval are merged; Furthermore, if the qualified continuous historical messages cover a part of a certain gap interval, the part of continuous historical messages in the gap interval is pulled from the server and updated to the local database, and the part of the gap interval is merged with the adjacent continuous time interval.
10. The device for obtaining continuous messages by an instant messaging client according to claim 6, characterized in that: The input parameters include the start timestamp of the query, the time axis direction of the query, and the number of messages queried.
Citation Information
Patent Citations
System, client end and method for obtaining history message and feeding back history message
CN101227425A
Method and device for synchronizing offline session messages in instant messaging tool
CN103051520A
Temporary offline session message reservation method, apparatus and system
CN105391623A
Message transmission method and device
CN108123866A
Chat message display method and device
CN110166346A