Realization method for unifying message sending time and related equipment
By using server timestamps in instant messaging systems to solve the client time deviation problem, the consistency and accuracy of message time can be ensured, improving user experience.
Patent Information
- Application Number
- CN202510941639.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-08
- Publication Date
- 2025-09-12
AI Technical Summary
In instant messaging software using the MQTT protocol, client time deviation leads to inconsistent message sending times, affecting message sequence and user understanding.
The timestamp is determined by the server's system time, and a confirmation message is sent to the client so that the client uses the timestamp as the message sending time to build a unified message time benchmark.
Ensure the consistency and accuracy of message time, avoid message order disorder caused by client time asynchrony, and improve user experience.
Smart Images

Figure CN120639731A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of instant messaging technology, and in particular to a method for implementing unified message sending time and related equipment. Background Art
[0002] With the rapid development of mobile internet, instant messaging (IM) software has become an essential tool for daily communication. The Message Queuing Telemetry Transport (MQTT) protocol, due to its lightweight, low-power consumption, and suitability for low-bandwidth and unstable network environments, is widely used for message transmission within IM software. In IM scenarios, the timing of message delivery is crucial for users, as it determines the order in which messages appear within the messaging software interface. If users transmit messages inconsistently, messages may appear out of order, causing confusion.
[0003] Currently, instant messaging software that uses the MQTT protocol for message transmission typically relies on the client's own time to record the time a message is sent. However, this approach has numerous drawbacks. For example, due to various reasons, such as inaccurate system time settings, network synchronization anomalies, and device aging, the client's time may deviate from the actual time. This can cause messages to be displayed out of order, affecting users' ability to view and understand chat logs.
[0004] Therefore, there is an urgent need for a method for unifying the message sending time to solve the problem of inconsistent message timing in instant messaging systems. Summary of the Invention
[0005] The present application provides a method for unifying message sending time and related devices to solve the problem of inconsistent message timing in an instant messaging system.
[0006] In the first aspect, the present application provides a method for implementing a unified message sending time, which is applied to a server. The method includes: in response to receiving an instant communication message sent by a first client, determining a first timestamp based on the system time of the server; and sending a confirmation message carrying the first timestamp to the first client, so that the first client uses the first timestamp as the sending time of the instant communication message.
[0007] In this application, after receiving an instant messaging message sent by a first client, a first timestamp is determined based on the server's system time; a confirmation message carrying the first timestamp is sent to the first client, so that the first client uses the first timestamp as the time the instant messaging message was sent. Thus, the first timestamp determined based on the server's system time is regarded as the time when the client sent the message, thereby establishing a unified message time reference, avoiding situations where the client's own time is out of sync and causes message order to be disordered, and ensuring the consistency and accuracy of message times.
[0008] A possible implementation method of the above-mentioned "in response to receiving an instant communication message sent by the first client, determining the first timestamp based on the system time of the server" specifically includes: in response to receiving the instant communication message, verifying the instant communication message, and when the verification is completed, using the system time of the server when the verification is passed as the first timestamp.
[0009] In another possible implementation, the receiving end of the instant messaging message is a second client, and the above method further includes: filling the first timestamp in the instant messaging message; forwarding the filled instant messaging message to the second client, so that the second client uses the first timestamp as the sending time of the instant messaging message.
[0010] Another possible implementation is that the instant messaging message is a message queue telemetry transmission MQTT message.
[0011] In another possible implementation, the first timestamp is filled in the user attribute field of the MQTT message.
[0012] In the second aspect, the present application provides a method for implementing a unified message sending time, which is applied to a first client, and the method includes: sending an instant communication message to a server; receiving a confirmation message sent by the server; the confirmation message carries a first timestamp; the first timestamp is determined based on the system time when the server receives the instant communication message.
[0013] This application sends an instant messaging message to a server and receives a confirmation message from the server that carries a first timestamp. The first timestamp is determined based on the system time at which the server receives the instant messaging message. Therefore, the time at which the first client sends the message is consistent with the server's system time, ensuring the consistency and accuracy of the message time.
[0014] In one possible implementation, the recipient of the instant messaging message is a second client, and the method further includes: the server filling the first timestamp into the instant messaging message; the server sends the filled instant messaging message to the second client, so that the second client uses the first timestamp as the sending time of the instant messaging message.
[0015] Another possible implementation is that the instant messaging message is a message queue telemetry transmission MQTT message.
[0016] In a third aspect, the present application provides a unified message sending time system, including: a server, for determining a first timestamp based on the system time of the server in response to receiving an instant communication message sent by a first client; sending a confirmation message carrying the first timestamp to the first client, so that the first client uses the first timestamp as the sending time of the instant communication message; a first client, for sending an instant communication message to the server; receiving a confirmation message sent by the server; the confirmation message carries a first timestamp; the first timestamp is determined based on the system time when the server receives the instant communication message.
[0017] In a possible implementation, the system further includes: a second client, configured to receive an instant messaging message sent by the server and filled with the first timestamp, so that the second client uses the first timestamp as the sending time of the instant messaging message.
[0018] In a fourth aspect, the present application provides an electronic device comprising: a processor and a memory; the memory stores instructions executable by the processor; when the processor is configured to execute the instructions, the electronic device implements the methods of the first and second aspects above.
[0019] In a fifth aspect, the present application provides a computer-readable storage medium, which includes: computer software instructions; when the computer software instructions are executed in an electronic device, the electronic device implements the methods of the first and second aspects above.
[0020] In a sixth aspect, the present application provides a computer program product, which includes a computer program; when the computer program runs in an electronic device, the electronic device implements the methods of the first and second aspects above.
[0021] The beneficial effects of the third to sixth aspects mentioned above refer to the corresponding descriptions of the first and second aspects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A schematic diagram of the structure of a unified message sending time system provided by this application;
[0023] Figure 2 A flowchart of a method for implementing a unified message sending time provided by this application;
[0024] Figure 3 A flowchart of another method for implementing unified message sending time provided by this application;
[0025] Figure 4A schematic diagram of the composition of a device for implementing unified message sending time applied to a server provided by this application;
[0026] Figure 5 A schematic diagram of the composition of an implementation device for unifying message sending time applied to a first client provided by the present application;
[0027] Figure 6 A schematic diagram of the composition of an electronic device provided in this application. DETAILED DESCRIPTION
[0028] The following is a detailed description of a method for implementing unified message sending time provided by the present application with reference to the accompanying drawings.
[0029] The terms "first" and "second" and the like in the specification and drawings of this application are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.
[0030] Furthermore, the terms "including," "having," and any variations thereof, as used in the description of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not limited to the listed steps or units but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to the process, method, product, or apparatus.
[0031] It should be noted that in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being more preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0032] In order to facilitate a clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with basically the same functions and effects. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order.
[0033] In the description of the present application, unless otherwise specified, “plurality” means two or more.
[0034] The following is a brief introduction to the relevant terms involved in the embodiments of this application.
[0035] The MQTT protocol, Message Queuing Telemetry Transport (MQTT), is an International Organization for Standardization (ISO) messaging protocol based on the publish-subscribe paradigm. Operating on top of TCP / IP, it is a publish / subscribe messaging protocol designed for remote devices with low-performance hardware and in poor network conditions. MQTT is specifically designed for low-bandwidth, high-latency, or unstable network environments. Its core mechanism is implemented through a message broker: devices act as publishers, sending messages to specific topics, and devices that subscribe to those topics receive the messages as subscribers. This avoids the complexity of point-to-point communication and ensures efficient and reliable data transmission.
[0036] With the rapid development of mobile internet, instant messaging (IM) software has become an essential tool for daily communication. Instant messaging software that uses the MQTT protocol for message transmission typically relies on the client's own time to record message sending times. However, this approach has numerous drawbacks.
[0037] First, due to various reasons, such as inaccurate system clock settings, network synchronization anomalies, and device aging, client devices may experience discrepancies between their time and the actual time. Time discrepancies between different clients can cause messages to be displayed out of order, impacting users' ability to properly view and understand chat logs. For example, in a group chat, if some members' clients are running too fast and others too slow, the order of messages in the chat log may not match the order in which they were actually sent, disrupting the coherence and logic of communication.
[0038] Secondly, when a client device is disconnected from the internet for an extended period or in airplane mode and then reconnects, the client time may not be synchronized accurately and promptly, resulting in significant discrepancies in the times recorded for subsequent messages. This time discrepancy not only affects the user's perception of message times but can also cause serious problems in scenarios involving recording important events and work communications. For example, in business communications, inaccurate message times can hinder the tracing and analysis of business processes.
[0039] Furthermore, differences in time settings and synchronization mechanisms across operating systems and device manufacturers further exacerbate the problem of client-side time inconsistency. This makes it difficult to ensure the consistency and accuracy of message times in cross-platform instant messaging applications. For example, an instant messaging app that supports both iOS and Android systems may display different time sequences and accuracy for messages in the same chat group on iOS and Android devices due to the different time synchronization mechanisms of the two systems, causing user confusion.
[0040] In summary, existing instant messaging software based on the MQTT protocol mostly relies on client time to record message time. This method has many shortcomings and may cause problems such as disordered message order, affecting users' normal viewing and understanding.
[0041] To address the above technical issues, this application provides a method and related device for implementing a unified message sending time. The method comprises: determining a first timestamp based on the server's system time in response to receiving an instant messaging message sent by a first client; and sending a confirmation message carrying the first timestamp to the first client, so that the first client uses the first timestamp as the sending time of the instant messaging message. Thus, by establishing a unified message time reference, the problem of inconsistent message timing in an instant messaging system is resolved, ensuring the consistency and accuracy of message times.
[0042] The embodiments provided in this application are described in detail below with reference to the accompanying drawings.
[0043] The method for implementing unified message sending time provided by this application can be applied to Figure 1 The unified messaging time system shown. Figure 1 As shown, the unified message sending time system 100 includes: a server 101 and a first client 102. The server 101 and the first client 102 are in communication connection.
[0044] In some embodiments, the unified message sending time system 100 further includes a second client 103 , wherein the second client 103 is in communication connection with the server 101 .
[0045] In some embodiments, the server 101 may be a server cluster consisting of multiple servers, or a single server, or a computer, or a processor or processing chip in a server or computer, etc. The embodiments of the present application do not limit the specific device form of the server 101. Figure 1 In the figure, the server 101 is taken as a single server as an example.
[0046] In some embodiments, when receiving the instant messaging message sent by the first client 102 , the server 101 determines a first timestamp based on the system time of the server 101 , and sends a confirmation message carrying the first timestamp to the first client 102 .
[0047] In some embodiments, the first client 102 sends an instant messaging message to the server 101 , and receives a confirmation message carrying a first timestamp sent from the server 101 .
[0048] In some embodiments, when the recipient of the instant communication message is the second client 103, the server 101 sends the instant communication message filled with the first timestamp to the second client 103, so that the second client 103 uses the first timestamp as the sending time of the instant communication message.
[0049] In some embodiments, the second client 103 may send an instant communication message to the server 101 . The server 101 receives the instant communication message sent by the second client 103 and sends a confirmation message carrying the first timestamp to the second client 103 .
[0050] It should be noted that the system architecture described in the embodiments of the present application is intended to more clearly illustrate the technical solutions of the embodiments of the present application, and does not constitute a limitation on the technical solutions provided in the embodiments of the present application. A person skilled in the art will know that with the evolution of the system architecture, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0051] See also Figure 2 , is a flow chart of a method for implementing a unified message sending time provided by an embodiment of the present application. Figure 2 As shown, the implementation method of unified message sending time provided by this application is applied to Figure 1 The server 101 in the unified message sending time system shown specifically includes the following steps S201-S202.
[0052] S201: In response to receiving an instant messaging message sent by a first client, determining a first timestamp based on a system time of a server.
[0053] In some embodiments, during a message transmission process of an instant messaging software, when a first client sends an instant messaging message to a server, the server may determine a first timestamp based on the system time when the instant messaging message sent by the first client is received.
[0054] In one possible implementation, the instant messaging message is a message queue telemetry transmission MQTT message.
[0055] Specifically, the first client constructs an instant messaging message based on the MQTT protocol, and the MQTT message includes basic information such as text content input by the user and a target recipient. Upon receiving the MQTT message sent by the first client, the server may determine a first timestamp based on the current accurate time recorded by the server.
[0056] According to the above technical means, constructing instant messaging messages through the MQTT protocol can ensure that the first timestamps are determined based on the accurate time recorded by the server, thereby ensuring the consistency of the message timing.
[0057] In a possible implementation, in response to receiving the instant communication message, the instant communication message is verified. When the verification is completed, the system time of the server when the verification is passed is used as the first timestamp.
[0058] Specifically, after receiving an MQTT message, the server verifies the message. Verification of the MQTT message involves verifying the legitimacy of the message, including checking the message format, content, and data integrity, to ensure that the MQTT message complies with the MQTT protocol specifications and the business requirements of the instant messaging software.
[0059] After completing the legitimacy check on the MQTT message, the server obtains the current accurate system time of the server, converts it into a millisecond timestamp, and determines the timestamp as the first timestamp.
[0060] It is understandable that the server's process of verifying the legitimacy of MQTT messages is very short, and the server's system time after verification is used as the first timestamp, which will not affect the user's message sorting.
[0061] According to the above technical means, after receiving an instant messaging message, the instant messaging message is verified to ensure that it meets the requirements. If the verification is successful, the server system time at the time of verification is used as the first timestamp. This ensures the legitimacy of the instant messaging message and uses the server system time at the time of verification as a unified time reference to avoid message sorting errors.
[0062] S202: Send a confirmation message carrying a first timestamp to the first client, so that the first client uses the first timestamp as the sending time of the instant messaging message.
[0063] The confirmation message includes the instant messaging message and a first timestamp, which is the server system time when the instant messaging message passes verification. The confirmation message is used to notify the first client that the instant messaging message has been successfully received and carries key information about the time the instant messaging message was sent.
[0064] In some embodiments, the server sends a confirmation message carrying a first timestamp to the first client. After receiving the confirmation message sent by the server, the first client displays the first timestamps carried in the confirmation message on its interface according to the time sequence.
[0065] In a possible implementation, the first timestamp is filled in the user attribute field of the MQTT message.
[0066] Specifically, user-properties in MQTT messages allow users to add custom metadata to messages. The server populates the first timestamp in the user-properties field of the MQTT message and sends the populated MQTT message to the first client. Upon receiving the MQTT message, the first client can parse the first timestamp in the user-properties field to obtain the exact send time of the MQTT message.
[0067] Exemplarily, the first timestamp filled in the user attribute field of the MQTT message may be in the format of "timestamp=current time (ms)", so that the first client can obtain the accurate time based on the "timestamp" in the user attribute.
[0068] It is understandable that for a message sent by the first client, the first client can parse the first timestamp in the user attribute field of the MQTT message returned by the server and regard it as the time when the first client sent the message, thereby achieving a unified message sending time for all clients. In this way, even if the client system clock device is inaccurate, network synchronization is abnormal, or the device is aging, resulting in a discrepancy between the client time and the actual time, the communication message sequence will not be disordered.
[0069] Based on this, the method for implementing unified message sending time provided in this application determines a first timestamp based on the server's system time after receiving an instant messaging message sent by a first client; then sends a confirmation message carrying the first timestamp to the first client, causing the first client to use the first timestamp as the sending time of the instant messaging message. Thus, the first timestamp determined based on the server's system time is regarded as the time when the client sent the message, thereby establishing a unified message time reference, avoiding situations where the client's own time is out of sync and causes message order to be disordered, and ensuring the consistency and accuracy of message times.
[0070] In one possible implementation, the receiver of the instant messaging message is a second client, and the method further includes: filling the first timestamp in the instant messaging message; forwarding the filled instant messaging message to the second client, so that the second client uses the first timestamp as the sending time of the instant messaging message.
[0071] In some embodiments, when a first client sends an instant messaging message to a second client, the first client first sends the instant messaging message to a server. The server verifies the legitimacy of the instant messaging message and adds the verified current system time of the server as a first timestamp to the instant messaging message. The server then forwards the filled instant messaging message to the second client.
[0072] It should be noted that when a first client sends an instant messaging message to a second client, the message must be transmitted through a server. The server can receive the instant messaging message sent by the first client and forward it to the second client. At the same time, it can also return the instant messaging message to the first client so that the first client's interface can display the instant messaging message.
[0073] According to the above technical means, when the recipient of the instant messaging message is the second client, the server fills the first timestamp into the instant messaging message and forwards the filled instant messaging message to the second client, ensuring that both the first client and the second client determine the message sending time based on the server's system time, thereby improving the consistency and reliability of message time management.
[0074] The method for implementing the unified message sending time provided in the embodiment of the present application can also be applied to the following examples: Figure 1 The first client 102 in the unified message sending system is shown. Figure 3 As shown, the method for unifying the message sending time further includes the following steps S301-S302.
[0075] S301: Send an instant messaging message to a server.
[0076] In some embodiments, the first client sends an instant communication message to the server. The server may receive the instant communication message sent from the first client and perform a validity check on the instant communication message to confirm that the instant communication message can be transmitted normally.
[0077] S302: Receive a confirmation message sent by the server; the confirmation message carries a first timestamp; the first timestamp is determined based on the system time when the server receives the instant messaging message.
[0078] In some embodiments, after receiving the instant communication message sent by the first client, the server determines the system time of receiving the instant communication message as the first timestamp, fills the first timestamp into the instant communication message, and sends it to the first client as a confirmation message.
[0079] The first client receives the confirmation message sent by the server, parses the first timestamp in the confirmation message as the sending time of the instant messaging message, and sorts the messages in the first client interface in the order of sending time.
[0080] Furthermore, after receiving the instant messaging message, the server performs a validity check on the instant messaging message, and uses the system time when the instant messaging message passes the validity check as the first timestamp.
[0081] In one possible implementation, the recipient of the instant messaging message is the second client, and the method further includes: the server filling the first timestamp in the instant messaging message; the server sends the filled instant messaging message to the second client, so that the second client uses the first timestamp as the sending time of the instant messaging message.
[0082] Specifically, a first client sends an instant messaging message to a second client. The server first receives the instant messaging message and, after verifying that it passes verification, adds a first timestamp to the instant messaging message and sends it to the second client. After receiving the instant messaging message, the second client parses the first timestamp to determine the time the instant messaging message was sent.
[0083] In one possible implementation, the instant messaging message is a message queue telemetry transmission MQTT message.
[0084] In another possible implementation, the first timestamp is filled in the user attribute field of the MQTT message.
[0085] The specific contents of the MQTT message and the user attribute field of the MQTT message are detailed in the above embodiment and will not be repeated here.
[0086] Based on this, the method for implementing unified message sending time provided in this application sends an instant messaging message to a server and receives a confirmation message from the server carrying a first timestamp; the first timestamp is determined based on the system time when the server receives the instant messaging message. As a result, the time when the first client sends the message can be consistent with the server's system time, ensuring the consistency and accuracy of the message time.
[0087] In some embodiments, when the second client sends an instant messaging message to the first client, the second client will first send the instant messaging message to the server. After the server verifies the legitimacy of the instant messaging message, it obtains the current system time as the first timestamp and fills it into the user attribute field in the instant messaging message.
[0088] The server sends a confirmation message carrying the first timestamp to the second client, and sends an instant messaging message filled with the first timestamp to the first client.
[0089] After receiving the confirmation message, the second client parses the first timestamp in the confirmation message, sorts the messages in chronological order of the first timestamps, and displays the messages.
[0090] After receiving the instant messaging message filled with the first timestamp, the first client parses the first timestamp in the user attribute field of the instant messaging message, and sorts and displays the messages according to the chronological order of the first timestamps.
[0091] Since both the first client and the second client determine the sending time of the instant messaging message based on the first timestamp determined by the server's system time after the server completes the legitimacy verification of the instant messaging message, a unified message time benchmark is constructed to ensure the consistency and accuracy of the message time.
[0092] It can be seen that the above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, the embodiment of the present application provides hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in combination with the modules and algorithm steps of each example described in the embodiment disclosed herein, the embodiment of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel 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 the present invention.
[0093] In the embodiments of the present application, the functional modules of the device for implementing the unified message sending time can be divided according to the above-mentioned method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into a single processing module. The above-mentioned integrated modules can be implemented in the form of hardware or software functional modules. Optionally, the module division in the embodiments of the present application is illustrative and is only a logical functional division. In actual implementation, other division methods may be used.
[0094] In some embodiments, the present application further provides a device for implementing a unified message sending time, which may include one or more functional modules for implementing the method for implementing a unified message sending time in the above method embodiment.
[0095] For example, Figure 4 This is a schematic diagram of a device for implementing a unified message sending time for a server provided in an embodiment of the present application. Figure 4 As shown, the apparatus 400 for implementing unified message sending time applied to a server includes: a determining unit 401 and a first processing unit 402 .
[0096] The determination unit 401 is used to determine the first timestamp based on the system time of the server in response to receiving the instant communication message sent by the first client; the first processing unit 402 is used to send a confirmation message carrying the first timestamp to the first client, so that the first client uses the first timestamp as the sending time of the instant communication message.
[0097] In some embodiments, the first processing unit 402 is specifically configured to verify the instant communication message in response to receiving the instant communication message, and when the verification is completed, use the system time of the server when the verification is passed as the first timestamp.
[0098] In other embodiments, the receiving end of the instant communication message is the second client, and the first processing unit 402 is further specifically used to fill the first timestamp in the instant communication message; forward the filled instant communication message to the second client, so that the second client uses the first timestamp as the sending time of the instant communication message.
[0099] In yet other embodiments, the instant messaging message is a message queue telemetry transport MQTT message.
[0100] In some further embodiments, the first timestamp is populated in a user attribute field of the MQTT message.
[0101] Figure 5 This is a schematic diagram of a composition of a device for implementing a unified message sending time applied to a first client provided in an embodiment of the present application. Figure 5 As shown, the apparatus 500 for implementing unified message sending time applied to the first client includes: a second processing unit 501 .
[0102] The second processing unit 501 is configured to send an instant messaging message to the server and receive a confirmation message from the server; the confirmation message carries a first timestamp; the first timestamp is determined based on the system time at which the server receives the instant messaging message.
[0103] In some embodiments, the receiving end of the instant communication message is the second client, and the second processing unit 501 is specifically used for the server to fill the first timestamp into the instant communication message; the server sends the filled instant communication message to the second client, so that the second client uses the first timestamp as the sending time of the instant communication message.
[0104] In yet other embodiments, the instant messaging message is a message queue telemetry transport MQTT message.
[0105] In the case of implementing the functions of the above-mentioned integrated modules in the form of hardware, the embodiment of the present invention provides a possible structural diagram of the electronic device involved in the above-mentioned embodiment. Figure 6 As shown, the electronic device 600 includes: a processor 602 , a communication interface 603 , and a bus 604 . Optionally, the electronic device 600 may further include a memory 601 .
[0106] Processor 602 may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 602 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field-programmable gate array, or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 602 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, or a combination of a DSP and a microprocessor.
[0107] The communication interface 603 is used to connect to other devices via a communication network, such as Ethernet, wireless access network, wireless local area network (WLAN), etc.
[0108] The memory 601 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0109] As a possible implementation, the memory 601 may exist independently of the processor 602. The memory 601 may be connected to the processor 602 via a bus 604 and used to store instructions or program codes. When the processor 602 calls and executes the instructions or program codes stored in the memory 601, the method for implementing the unified message sending time provided in the embodiment of the present invention can be implemented.
[0110] In another possible implementation, the memory 601 may also be integrated with the processor 602 .
[0111] The bus 604 may be an extended industry standard architecture (EISA) bus, etc. The bus 604 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0112] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the service calling device can be divided into different functional modules to complete all or part of the functions described above.
[0113] The embodiment of the present application also provides a computer-readable storage medium. All or part of the processes in the above-mentioned method embodiment can be completed by computer instructions to instruct the relevant hardware, and the program can be stored in the above-mentioned computer-readable storage medium. When the program is executed, it may include the processes of the above-mentioned method embodiments. The computer-readable storage medium can be the memory of any of the above-mentioned embodiments. The above-mentioned computer-readable storage medium can also be an external storage device of the above-mentioned service calling device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the above-mentioned service calling device. Furthermore, the above-mentioned computer-readable storage medium can also include both the internal storage unit of the above-mentioned service calling device and an external storage device. The above-mentioned computer-readable storage medium is used to store the above-mentioned computer program and other programs and data required by the above-mentioned service calling device. The above-mentioned computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.
[0114] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program product runs on a computer, it enables the computer to execute any one of the methods for unifying message sending time provided in the above embodiments.
[0115] The above are only specific embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A method for unifying message sending time, characterized in that: Applied to a server, the method includes: In response to receiving an instant messaging message sent by a first client, determining a first timestamp based on a system time of the server; A confirmation message carrying the first timestamp is sent to the first client, so that the first client uses the first timestamp as the sending time of the instant messaging message.
2. The method according to claim 1, characterized in that The step of determining a first timestamp based on a system time of the server in response to receiving an instant messaging message sent by the first client comprises: In response to receiving the instant communication message, the instant communication message is verified. When the verification is completed, the system time of the server when the verification is passed is used as a first timestamp.
3. The method according to claim 1, characterized in that The receiving end of the instant messaging message is a second client; the method further includes: Filling the first timestamp into the instant messaging message; The padded instant communication message is forwarded to the second client, so that the second client uses the first timestamp as the sending time of the instant communication message.
4. The method according to any one of claims 1 to 3, characterized in that The instant messaging message is a message queue telemetry transmission MQTT message.
5. The method according to claim 4, characterized in that The first timestamp is filled in the user attribute field of the MQTT message.
6. A method for unifying message sending time, characterized in that: Applied to a first client, the method includes: Send instant messaging messages to the server; A confirmation message sent by the server is received; the confirmation message carries a first timestamp; the first timestamp is determined based on the system time when the server receives the instant messaging message.
7. The method according to claim 6, characterized in that The receiving end of the instant messaging message is a second client, and the method further includes: The server fills the first timestamp into the instant messaging message; The server sends the filled instant communication message to the second client, so that the second client uses the first timestamp as the sending time of the instant communication message.
8. The method according to claim 6 or 7, characterized in that The instant messaging message is a message queue telemetry transmission MQTT message.
9. A unified message sending time system, characterized in that: The system comprises: The server is configured to, in response to receiving an instant messaging message sent by a first client, determine a first timestamp based on a system time of the server; and send a confirmation message carrying the first timestamp to the first client, so that the first client uses the first timestamp as a sending time of the instant messaging message; The first client is used to send an instant messaging message to a server; receive a confirmation message sent by the server; the confirmation message carries a first timestamp; the first timestamp is determined based on the system time when the server receives the instant messaging message.
10. The system according to claim 9, characterized in that The system further comprises: The second client is configured to receive the instant communication message sent by the server and filled with the first timestamp, so that the second client uses the first timestamp as the sending time of the instant communication message.
11. An electronic device, characterized in that: It includes a processor and a memory, the processor is coupled to the memory; the memory is used to store computer instructions, and the computer instructions are loaded and executed by the processor to enable the computer device to implement the method for implementing unified message sending time as described in any one of claims 1-5 or 6-8.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium includes computer-executable instructions. When the computer-executable instructions are executed on a computer, the computer is enabled to execute the method for implementing unified message sending time according to any one of claims 1-5 or 6-8.