Chat service system, chat message processing method and electronic equipment
By introducing a message notification mechanism in the chat service system, the server only sends message notifications instead of directly pushing message content, and the target client actively requests message content, solving the problems of large bandwidth consumption under high concurrency and degradation of server performance, achieving more efficient resource utilization and user experience.
Patent Information
- Application Number
- CN202411908293.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-03-28
AI Technical Summary
In the case of high concurrency, the frequent push of chat messages leads to large bandwidth consumption and degradation of server processing performance, which can easily lead to paralysis of the server and affect user experience.
When the server receives a chat message, it only sends a message notification to the target client, indicating that there is a chat message to be received, rather than directly pushing the message content. After receiving the message notification, the target client actively sends a obtain request to the server to obtain the message content of the chat message to be received.
By reducing the frequent push of message content, the concurrent processing volume and bandwidth consumption of the server are reduced, the stability and reliability of the server are improved, and the user experience is improved.
Smart Images

Figure CN119728629A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and in particular to a chat service system, a chat message processing method and an electronic device. Background Art
[0002] A chat service system is a system that provides communication and interactive services in various forms such as text, voice, and video. It is usually used in scenarios such as social media interaction and virtual assistants to achieve communication and exchange between users or between users and service providers.
[0003] In the current chat service system, every time the server obtains a chat message, it will push the message content of the chat message to the corresponding client in real time. When users or group chats send chat messages frequently, the server needs to frequently push message content to each corresponding client, which consumes a lot of bandwidth. In addition, high concurrency can easily lead to a decrease in server processing performance, which in turn causes the server to crash and affect the user experience. Summary of the invention
[0004] The embodiments of the present application provide a chat service system, a chat message processing method and an electronic device, which can reduce the bandwidth consumption of the chat service system.
[0005] In a first aspect, an embodiment of the present application provides a chat service system, including a server and multiple clients;
[0006] The server is used to, upon receiving a chat message sent by any of the clients, determine a target client corresponding to the chat message, and send a message notification to the target client, wherein the target client includes a client to receive the chat message, and the message notification is used to indicate that the target client has a chat message to be received;
[0007] The target client is used to receive the message notification and send an acquisition request to the server, wherein the acquisition request is used to instruct the server to send the message content of all the chat messages to be received by the target client;
[0008] The server is configured to, upon receiving the acquisition request, send the message content corresponding to the acquisition request to the target client corresponding to the acquisition request;
[0009] The target client is also used to store and display the received message content.
[0010] In a second aspect, an embodiment of the present application provides a chat message processing method, which is applied to a server, including:
[0011] In the case of receiving a chat message sent by any client, determining a target client corresponding to the chat message, wherein the target client includes a client to receive the chat message;
[0012] Sending a message notification to the target client, wherein the message notification application indicates that the target client has a chat message to be received;
[0013] When receiving the acquisition request sent by the target client, the message content corresponding to the acquisition request is sent to the target client, and the acquisition request is used to instruct the server to send the message content of all the chat messages to be received by the target client.
[0014] In a third aspect, an embodiment of the present application provides a chat message processing method, which is applied to a client, including:
[0015] Receive a message notification sent by the server, where the message notification is used to indicate that the client has a chat message to be received;
[0016] Sending an acquisition request to the server, wherein the acquisition request is used to instruct the server to send the message content of all the chat messages to be received by the client;
[0017] Receive the message content sent by the server, and store and display the message content.
[0018] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the chat message processing method described in the second aspect or the third aspect when executing the computer program.
[0019] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the chat message processing method described in the second aspect or the third aspect are implemented.
[0020] In a sixth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the chat message processing method described in the second aspect or the third aspect above.
[0021] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0022] In the embodiment of the present application, after receiving a chat message sent by any client, the server does not directly send the chat message to the target client to receive the chat message, but sends a message notification to the target client to indicate that the target client has a chat message to receive, and only after receiving the acquisition request sent by the target client, does it send the message content corresponding to the acquisition request to the target client. That is, in the chat service system, the server informs the target client of the existence of a chat message to be received through a message notification, and does not directly send the message content to the target client every time a chat message is received. After the target client receives the message notification, it can actively request the message content of all the chat messages to be received when necessary, so as to store and display the message content of the chat message, which better meets the target client's demand for displaying the message content, and there is no need to frequently send and receive message content between the target client and the server, which can reduce the concurrent processing volume of the server, effectively reduce bandwidth consumption and reduce the probability of performance bottlenecks on the server, which is conducive to improving the reliability of the chat service system and improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0024] Figure 1 It is a structural diagram of a chat service system provided by an embodiment of the present application;
[0025] Figure 2 It is a structural diagram of another chat service system provided in an embodiment of the present application;
[0026] Figure 3 It is a structural diagram of another chat service system provided in an embodiment of the present application;
[0027] Figure 4 It is a flow chart of a chat service system processing group chat messages provided by an embodiment of the present application;
[0028] Figure 5 It is a flowchart of a chat message processing method provided by an embodiment of the present application;
[0029] Figure 6 It is a flowchart of another chat message processing method provided in an embodiment of the present application;
[0030] Figure 7 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0032] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0033] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0034] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.
[0035] Embodiment 1:
[0036] Figure 1 A structural schematic diagram of a chat service system provided by an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0037] Reference Figure 1 The chat service system includes a server 11 and multiple clients 12.
[0038] Understandably, Figure 1 Only a structural diagram of a chat service system including three clients 12 is given. In actual applications, one user usually corresponds to at least one client 12, and a chat service system usually includes a large number of users, that is, a chat service system usually includes a large number of clients 12.
[0039] The above-mentioned server 11 is used to determine the target client 12 corresponding to the above-mentioned chat message when receiving the chat message sent by any of the above-mentioned clients 12, and send a message notification to the above-mentioned target client 12. The above-mentioned target client 12 includes the client 12 to receive the above-mentioned chat message. The above-mentioned message notification is used to indicate that the above-mentioned target client 12 has a chat message to be received.
[0040] The target client 12 is used to receive the message notification and send a request to the server 11. The request is used to instruct the server 11 to send the target client 12 the message content of all the chat messages to be received.
[0041] The server 11 is used to send the message content corresponding to the acquisition request to the target client 12 corresponding to the acquisition request when receiving the acquisition request.
[0042] The target client 12 is also used to store and display the received message content.
[0043] It can be understood that the client 12 can run a chat application corresponding to the chat service system. After the user enters a chat message in the chat page of the chat application, the client 12 will send the chat message to the server 11.
[0044] The above chat messages include but are not limited to text, emoticons, pictures, audio and video, and files.
[0045] The above-mentioned chat application is an application that supports users to communicate through at least one method such as text, voice or video, such as an instant messaging application.
[0046] Currently, after receiving a chat message sent by a client 12, the server 11 usually needs to send the chat message to the client 12 that needs to receive the chat message (i.e., the target client 12), so that the client 12 can display the chat message on the chat page in the chat application, and after receiving the chat message, the target client 12 usually needs to send a notification message back to the server 11 indicating that the message has been received, so that the server 11 needs to send and receive messages with the target client 12 every time it receives a chat message, which consumes a lot of bandwidth and requires a high message processing capability of the server 11.
[0047] In the embodiment of the present application, after receiving the chat message sent by the client 12, the server 11 does not directly send the chat message to the determined target client 12, but informs the target client 12 that there is a chat message to be received by sending a message notification. That is, when the server 11 receives a chat message, it usually only needs to send a message notification to each corresponding target client 12, without pushing its message content, which can effectively reduce the amount of concurrent data, thereby effectively avoiding problems such as network congestion and extended response time caused by excessive concurrent data volume, improving the stability and reliability of the server 11, and helping to improve the reliability of the chat service system.
[0048] Since the target client 12 can determine that it has chat messages to be received based on the received message notification, the target client 12 can actively request the server 11 to send the message content of all chat messages to be received by sending a request when it needs to receive the chat messages to be received, instead of passively receiving each chat message to be received in real time.
[0049] In some embodiments, since the server 11 sends a message notification to the target client 12 but does not include the message content of the chat message, the target client 12 may not send a received message notification back to the server 11 after receiving the message notification. Instead, after receiving the message content sent by the server 11 in response to the acquisition request, it may send a received message notification back, thereby effectively reducing unnecessary interactions between the target client 12 and the server 11, thereby reducing the message processing volume and resource consumption of the server 11.
[0050] In the embodiment of the present application, after receiving a chat message sent by any client 12, the server 11 does not directly send the chat message to the target client 12 to receive the chat message, but sends a message notification to the target client 12 to indicate that the target client 12 has a chat message to receive, and only after receiving the acquisition request sent by the target client 12, does it send the message content corresponding to the acquisition request to the target client 12. That is, in the chat service system, the server 11 informs the target client 12 of the existence of the chat message to be received through the message notification, and does not directly send the message content to the target client 12 every time a chat message is received. After receiving the message notification, the target client 12 can actively request the message content of all the chat messages to be received when necessary, so as to store and display the message content of the chat message, that is, the target client 12 can better obtain and display the message content in accordance with its display requirements, and there is no need to frequently send and receive message content between the target client 12 and the server 11, which can reduce the concurrent processing volume of the server 11, ensure the processing performance of the server 11, and effectively reduce bandwidth consumption, which is conducive to improving the reliability of the chat service system and improving user experience.
[0051] In some embodiments, the target client 12 sends a request to the server 11, including:
[0052] When the preset request time is reached and / or when the number of unpulled messages is greater than or equal to the target number, the target client sends the acquisition request to the server 11, where the number of unpulled messages is the number of chat messages to be received determined based on the message notification.
[0053] Optionally, the preset request time may be a specific time set in advance or a dynamically determined time. For example, the time when the target client 12 performs a preset action (such as opening a chat page or opening a chat application, etc.) may be used as the preset request time. The embodiment of the present application does not impose any specific restrictions on this.
[0054] When the preset request time is the time when the target client 12 executes the preset action, the acquisition request can be a request for the server 11 to send the message content of all chat messages currently to be received by the target client 12, or it can be a request for the server 11 to send the message content of all chat messages to be received corresponding to the preset action executed by the target client 12.
[0055] As an example, the preset request time may be a time determined according to a preset request frequency (such as once per hour), and the target client 12 may send a request to the server 11 at every hour. Optionally, the user may manually set the preset request frequency in the chat application, so that the client can actively pull the message content of the chat message according to the user's needs.
[0056] As another example, the preset action may be opening a chat page. In this case, the preset request time is the time when the target client 12 opens the chat page. The target client 12 may instruct the server 11 to send the message content of all chat messages to be received corresponding to the chat page opened by the target client 12 by obtaining the request.
[0057] Optionally, the above-mentioned unpulled number may be the number of all chat messages to be received, or the number of all chat messages to be received in a session, which is not specifically limited here.
[0058] For example, the target client 12 can count the number of unreceived messages corresponding to each session in the chat application. Correspondingly, the target client 12 can obtain the message content of all chat messages to be received in the target session (i.e., the session whose number of unreceived messages is greater than or equal to the target number) through an acquisition request.
[0059] In the embodiment of the present application, the target client 12 may send a request to the server 11 if the request condition is met. The request condition may include at least one of a preset request time and a target quantity.
[0060] If the request conditions include a preset request time and a number of unpulled items, the target client 12 may send a request to the target client 12 when either of the conditions is met, or may send a request to the target client 12 when both the preset request time and the number of unpulled items are met. The specific settings can be made according to actual needs.
[0061] In an embodiment of the present application, the target client 12 can determine whether the preset request time has been reached and / or whether the number of chat messages to be received has reached the target number, thereby deciding whether to actively pull the message content of the chat messages to be received, thereby reducing resource consumption by reducing the interaction with the server 11, while better meeting the message display requirements of the target client 12.
[0062] Figure 2 A structural schematic diagram of another chat service system provided in an embodiment of the present application is shown.
[0063] Reference Figure 2The chat service system further includes at least one communication server 13 , and the service end 11 includes a message processing server 111 and a message sending server 112 .
[0064] The message processing server 111 is used to determine the target client 12 according to the received chat message, generate the message notification according to the identifier of the target client 12, and send the message notification to the message sending server 112. The message notification includes the identifier of the target client 12.
[0065] The message sending server 112 is used to receive the message notification, determine the target communication server 13 according to the identifier in the message notification, and send the message notification to the target communication server 13, which includes the communication server 13 corresponding to the target client 12.
[0066] The target communication server 13 is used to forward the received message notification to the target client 12 .
[0067] The above-mentioned communication server 13 refers to a server used to provide communication services for users on the network who need to transmit files or information through a remote communication link, including but not limited to instant messaging servers, message queue servers, and long connection communication servers 13.
[0068] In order to further improve the message processing capability of the chat service system, in an embodiment of the present application, the server 11 includes a message processing server 111 and a message sending server 112. After receiving the chat message, the server 11 first determines the target client 12 corresponding to the chat message by the message processing server 111, and generates a corresponding message notification based on the identifier of the target client 12, and then sends it to the message sending server 112.
[0069] The message sending server 112 is connected to the client 12 through the communication server 13 in the chat service system. After receiving the message notification, the message sending server 112 can determine the communication server 13 (i.e., the target communication server 13) corresponding to the target client 12 according to the identifier in the message notification, and then, the message notification can be sent to the target communication server 13, and the target communication server 13 forwards the message notification to the target client 12.
[0070] In some embodiments, the message processing server 111 may generate one or more message queues as preset message queues. Figure 3As shown, after generating a message notification, the message processing server 111 can store the message notification in a preset message queue. The message sending server 112 will monitor the preset message queue in real time. If it is detected that there is a message notification stored in the preset message queue, the message notification can be taken out and sent to the target communication server 13. There is no need to send and receive message notifications between the message processing server 111 and the message sending server 112, which further reduces the resource consumption of the server 11.
[0071] In an embodiment of the present application, the chat message is processed by the message processing server 111, and the message notification is sent to the target communication server 13 through the message sending server 112, so that the target communication server 13 forwards the message notification to the target client 12, effectively realizing the decoupling of message processing and sending, so that the message processing server 111 can focus on message processing, improve the message processing capability of the server 11, and thus improve the ability of the server 11 to handle high-concurrency messages.
[0072] In some embodiments, the message processing server 111 is also used to store the message content of the chat message in a database.
[0073] The message sending server 112 is also used to receive the acquisition request, obtain the message content corresponding to the acquisition request from the database, and send the message content to the corresponding target communication server 13.
[0074] The target communication server 13 is also used to forward the received message content to the target client 12.
[0075] Optionally, the above-mentioned database can be a relational database such as MySQL (My Structured Query Language), or a non-relational database such as Redis. The embodiment of the present application does not impose any specific restrictions on the database used to store message content.
[0076] Optionally, the message processing server 111 can pre-build a message table based on fields such as message identifier, message type, message content, source client (i.e., client sending the chat message), target client, and sending time. When the message processing server 111 needs to store the message content, the message content of a chat message can be stored as a piece of data in the message table. Since the message content of the chat message will be stored in the message content field of this piece of data, and the target client field can indicate the target client corresponding to the piece of data (relative to the chat message), that is, each piece of data in the message table corresponds to a chat message, and each piece of data contains relevant information of the corresponding chat message. Therefore, after receiving the acquisition request, the message sending server 112 can quickly and accurately obtain the message content corresponding to the acquisition request from the message table, which is conducive to improving the speed at which the message sending server 112 responds to the acquisition request.
[0077] In some embodiments, the server 11 may also include an object storage server, which may be used to store media files such as pictures, audio and video or files, that is, the message processing server 111 may store the media files in the message content in the object storage server. At this time, the message processing server 111 may record the file identifier of the media file in the corresponding data in the message table to associate the message content and its corresponding media file. Optionally, the message table may also record data such as thumbnails and video cover images of the media files. Through the above processing, the connection between the message content in the message table and the corresponding media files in the object storage server can be well established, thereby achieving effective storage of chat messages.
[0078] As an example, when the client 12 detects that the user clicks on a media file in the chat page, it can directly send a media file acquisition request to the object storage server, and the media file acquisition request can include a target file identifier (i.e., a file identifier corresponding to the media file clicked by the user). Figure 4 As shown, after the object storage server determines the media file corresponding to the media file acquisition request (assuming it is called the target media file), it will send the target media file to the corresponding client 12. After the client 12 receives the target media file returned by the object storage server, it can display the target media file in the corresponding chat page.
[0079] In some embodiments, the message sending server 112 can store the current number of chat messages to be received by each client 12 (assuming it is called the unpulled number) in a cache manner. Every time a message notification is obtained, the message server can directly update the unpulled number of the corresponding client 12 in the cache without having to perform a full table scan of the message table through a query statement to obtain the unpulled number of each client 12, thereby avoiding the performance pressure brought to the message sending server 112 by executing the query statement.
[0080] Optionally, after the message processing server 111 obtains the corresponding message content from the database according to the acquisition request, it can determine whether the message content is missed based on the number of chat messages corresponding to the acquired message content and the number of un-pulled messages corresponding to the client 12 in the cache, so as to ensure that all message contents requested by the acquisition request are accurately returned.
[0081] As an example, the message processing server 111 may maintain a corresponding message table for each client 12, and the message table is used to store the message content of the chat message that the corresponding client 12 should receive. The message table may include a pull status field, and the pull status may include received or not received, which is used to indicate whether the client 12 has received the corresponding message content. After receiving the acquisition request sent by the client 12, the message sending server 112 can filter out the message content with a pull status of not received from the message table corresponding to the client 12, and use it as the message content corresponding to the acquisition request and send it to the target communication server 13.
[0082] In the embodiment of the present application, the message processing server 111 stores the content of the chat message directly in the database, and the message sending server 112 can directly obtain the message content corresponding to the acquisition request from the database, which can better realize the separation processing of the message content.
[0083] In some embodiments, the step of forwarding the received message notification to the target client 12 includes:
[0084] In the case that a long connection relationship exists between the target client 12 and the target communication server 13 , the target communication server 13 forwards the message notification to the target client 12 .
[0085] In the embodiment of the present application, after the user logs in to the chat application running on the client 12, the client 12 will establish a persistent connection relationship with the corresponding target communication server 13, that is, when the client 12 and the target communication server 13 have a persistent connection relationship, it can be considered that the user of the chat application is online. After receiving the message notification sent by the message sending server 112, the target communication server 13 can first determine whether there is a persistent connection relationship between it and the target client 12.
[0086] If there is a long connection relationship between the target communication server 13 and the target client 12, it can be considered that the user is online. At this time, the target communication server 13 can send message notifications to the target client 12 in real time, so that the target client 12 can obtain the chat messages that it currently has to receive in time.
[0087] If there is no persistent connection relationship between the target communication server 13 and the target client 12 , it can be considered that the user is in an offline state. At this time, the target communication server 13 can decide whether to send a message notification to the target client 12 according to the actual application scenario.
[0088] As an example, the target communication server 13 may send its corresponding message notification to the target client 12 when establishing a long connection relationship with the target client 12 .
[0089] As another example, if there is no persistent connection relationship between the target communication server 13 and the target client 12, there is no need to send a message notification to the target client 12. When establishing a persistent connection relationship between the client 12 and the target communication server 13, the client 12 can actively send a request to its corresponding communication server 13, and the target communication server 13 sends the request to the message sending server 112, so that the message sending server 112 can send the content of all the chat messages to be received by the client 12. Through the above processing, unnecessary message sending and receiving are reduced, and at the same time, when the user logs in to the chat application, the user can obtain the content of all the chat messages to be received in time, so that the user can view the corresponding chat messages.
[0090] In an embodiment of the present application, when the target communication server 13 receives a message notification, if there is a long connection relationship between the target client 12 and the target communication server 13, that is, the user has logged in to the chat application, the target communication server 13 will then send the message notification to the target client 12, so that the target client 12 can be informed in a timely manner that there is a chat message to be received.
[0091] In some embodiments, the client 12 is used to send a real-time acquisition request to the server 11 when there is an open chat page. The real-time acquisition request is used to instruct the server 11 to send the target message content in real time. The target message content includes the message content of the chat message corresponding to the open chat page.
[0092] The server 11 is also used to send the target message content to the client 12 corresponding to the real-time acquisition request in real time when receiving the real-time acquisition request.
[0093] Optionally, when the client 12 detects that the target chat page (i.e., the chat page corresponding to the target message content) is closed, the client 12 may send a notification request to the server 11, where the notification request is used to instruct the server 11 to send a message notification of the chat message corresponding to the target chat page, i.e., there is no need to send the target message content in real time.
[0094] In the embodiment of the present application, since the probability of a user viewing a chat message in real time on an open chat page is relatively high, when there is an open chat page, the client 12 will instruct the server 11 to send the content of the chat message corresponding to the open chat page in real time through a real-time acquisition request, so that the client 12 can display the chat message corresponding to the chat page in the open chat page in a timely manner, which is conducive to improving the user experience.
[0095] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0096] Embodiment 2:
[0097] Corresponding to the chat service system described in the above embodiment, Figure 5 A chat message processing method applied to a server provided in an embodiment of the present application is shown. For ease of explanation, only the part related to the embodiment of the present application is shown. The above method is described in detail as follows:
[0098] Step S501, when a chat message sent by any client is received, a target client corresponding to the chat message is determined, where the target client includes a client to receive the chat message.
[0099] Step S502: Send a message notification to the target client, where the message notification application indicates that there is a chat message to be received by the target client.
[0100] Step S503, upon receiving the acquisition request sent by the target client, the message content corresponding to the acquisition request is sent to the target client, and the acquisition request is used to instruct the server to send the message content of all the chat messages to be received by the target client.
[0101] In the embodiment of the present application, after receiving a chat message sent by any client, the server does not directly send the chat message to the target client to receive the chat message, but sends a message notification to the target client to indicate that the target client has a chat message to be received, that is, when the server receives a chat message, it usually only needs to send a message notification to each corresponding target client without pushing its message content, which can effectively reduce the amount of concurrent data, thereby effectively avoiding network congestion and extended response time caused by excessive concurrent data volume, improving the stability and reliability of the server, and helping to improve the reliability of the chat service system. In addition, after receiving the acquisition request sent by the target client, the message content of all the chat messages requested by it is sent at one time, so that the target client can obtain the message content it needs in a timely manner, effectively ensuring the user experience.
[0102] Corresponding to the chat service system described in the above embodiment, Figure 6 A chat message processing method applied to a client provided by an embodiment of the present application is shown. For ease of explanation, only the part related to the embodiment of the present application is shown. The above method is described in detail as follows:
[0103] Step S601, receiving a message notification sent by the server, wherein the message notification is used to indicate that the client has a chat message to be received.
[0104] Step S602: Send an acquisition request to the server, where the acquisition request is used to instruct the server to send the message content of all the chat messages to be received by the client.
[0105] Step S603, receiving the message content sent by the server, storing and displaying the message content.
[0106] In an embodiment of the present application, the client can determine that it has chat messages to be received based on the received message notification. Therefore, when the client needs to obtain the chat messages to be received, it can actively request the server to send the message content of all the chat messages to be received by sending a request for acquisition, instead of passively receiving each chat message to be received in real time. This can reduce the resource consumption of the client while better meeting the client's demand for displaying message content, which is conducive to improving user experience.
[0107] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0108] Embodiment three:
[0109] Figure 7This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 7 As shown, the electronic device 7 of this embodiment includes: at least one processor 70 ( Figure 7 Only one processor is shown in the figure), a memory 71, and a computer program 72 stored in the memory 71 and executable on the at least one processor 70, wherein the processor 70 implements the steps of any of the above-mentioned method embodiments when executing the computer program 72.
[0110] The electronic device 7 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device may include, but is not limited to, a processor 70 and a memory 71. Those skilled in the art will appreciate that Figure 7 It is only an example of the electronic device 7 and does not constitute a limitation on the electronic device 7. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0111] The processor 70 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0112] In some embodiments, the memory 71 may be an internal storage unit of the electronic device 7, such as a hard disk or memory of the electronic device 7. In other embodiments, the memory 71 may also be an external storage device of the electronic device 7, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the electronic device 7. The memory 71 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 71 may also be used to temporarily store data that has been output or is to be output.
[0113] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0114] An embodiment of the present application also provides a network device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps in any of the above-mentioned method embodiments when executing the computer program.
[0115] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0116] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0117] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0118] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0119] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software 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 be beyond the scope of this application.
[0120] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0121] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0122] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A chat service system, characterized in that: Including server and multiple clients; The server is used to, upon receiving a chat message sent by any of the clients, determine a target client corresponding to the chat message, and send a message notification to the target client, wherein the target client includes a client to receive the chat message, and the message notification is used to indicate that the target client has a chat message to be received; The target client is used to receive the message notification and send an acquisition request to the server, wherein the acquisition request is used to instruct the server to send the message content of all the chat messages to be received by the target client; The server is configured to, upon receiving the acquisition request, send the message content corresponding to the acquisition request to the target client corresponding to the acquisition request; The target client is also used to store and display the received message content.
2. The chat service system according to claim 1, characterized in that: The target client sends a request to the server, including: When the preset request time is reached and / or when the number of unpulled messages is greater than or equal to the target number, the target client sends the acquisition request to the server, where the number of unpulled messages is the number of chat messages to be received determined based on the message notification.
3. The chat service system according to claim 1, characterized in that: The chat service system further comprises at least one communication server, and the service end comprises a message processing server and a message sending server; The message processing server is used to determine the target client according to the received chat message, generate the message notification according to the identifier of the target client, and send the message notification to the message sending server, wherein the message notification includes the identifier of the target client; The message sending server is used to receive the message notification, determine the target communication server according to the identifier in the message notification, and send the message notification to the target communication server, wherein the target communication server includes the communication server corresponding to the target client; The target communication server is used to forward the received message notification to the target client.
4. The chat service system according to claim 3, characterized in that: The message processing server is further used to store the message content of the chat message in a database; The message sending server is further used to receive the acquisition request, obtain the message content corresponding to the acquisition request from the database, and send the message content to the corresponding target communication server; The target communication server is also used to forward the received message content to the target client.
5. The chat service system according to claim 3, characterized in that: The target communication server forwards the received message notification to the target client, including: In the case that a long connection relationship exists between the target client and the target communication server, the target communication server forwards the message notification to the target client.
6. The chat service system according to any one of claims 1 to 5, characterized in that: The client is used to send a real-time acquisition request to the server when there is an open chat page, wherein the real-time acquisition request is used to instruct the server to send target message content in real time, and the target message content includes the message content of the chat message corresponding to the open chat page; The server is also used to send the target message content to the client corresponding to the real-time acquisition request in real time when receiving the real-time acquisition request.
7. A chat message processing method, characterized in that: Applied to the server, including: In the case of receiving a chat message sent by any client, determining a target client corresponding to the chat message, wherein the target client includes a client to receive the chat message; Sending a message notification to the target client, wherein the message notification application indicates that the target client has a chat message to be received; When receiving the acquisition request sent by the target client, the message content corresponding to the acquisition request is sent to the target client, and the acquisition request is used to instruct the server to send the message content of all the chat messages to be received by the target client.
8. A chat message processing method, characterized in that: Applied to the client, including: Receive a message notification sent by the server, where the message notification is used to indicate that the client has a chat message to be received; Sending an acquisition request to the server, wherein the acquisition request is used to instruct the server to send the message content of all the chat messages to be received by the client; Receive the message content sent by the server, and store and display the message content.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to claim 7 or claim 8 is implemented.
10. A computer program product, characterized in that When the computer program product runs on an electronic device, the electronic device is caused to execute the method according to claim 7 or claim 8.