CN112751748A - Session message management method, device, server and readable storage medium - Google Patents

Session message management method, device, server and readable storage medium Download PDF

Info

Publication number
CN112751748A
CN112751748A CN202011595184.2A CN202011595184A CN112751748A CN 112751748 A CN112751748 A CN 112751748A CN 202011595184 A CN202011595184 A CN 202011595184A CN 112751748 A CN112751748 A CN 112751748A
Authority
CN
China
Prior art keywords
session
client
channel layer
message
layer node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011595184.2A
Other languages
Chinese (zh)
Other versions
CN112751748B (en
Inventor
梁为涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bigo Technology Pte Ltd
Original Assignee
Bigo Technology Pte Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bigo Technology Pte Ltd filed Critical Bigo Technology Pte Ltd
Priority to CN202011595184.2A priority Critical patent/CN112751748B/en
Publication of CN112751748A publication Critical patent/CN112751748A/en
Application granted granted Critical
Publication of CN112751748B publication Critical patent/CN112751748B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • H04L51/043Real-time or near real-time messaging, e.g. instant messaging [IM] using or handling presence information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/216Handling conversation history, e.g. grouping of messages in sessions or threads
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/1066Session management
    • H04L65/1069Session establishment or de-establishment
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • H04L65/403Arrangements for multi-party communication, e.g. for conferences

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application discloses a session message management method, a session message management device, a session message management server and a readable storage medium, and belongs to the technical field of Internet. The method comprises the following steps: receiving a session message sent by a first client, sending the session message of which the number does not exceed the preset message number to a channel layer node, and controlling the channel layer node to send the session message to a second client connected with the channel layer node. When the session management server sends the session messages, the number of the session messages sent to the channel layer node does not exceed the preset message number, and when the number of the clients is large, the number of the session messages sent to the channel layer node by the session management server can be reduced, so that the load of the session management server can be reduced, and the communication efficiency can be improved.

Description

Session message management method, device, server and readable storage medium
Technical Field
The invention belongs to the technical field of internet, and particularly relates to a session message management method, a session message management device, a session message management server and a readable storage medium.
Background
Instant Messaging (IM) refers to a service that is capable of sending and receiving internet messages instantly. Based on the IM system, a session between a plurality of clients can be established, and the plurality of clients can send and receive session messages to and from each other through the established session. During the session, when receiving the message sent by one of the clients, the session management server may send the session message to the other clients in the session based on the pre-established session.
In the process of implementing the present application, the inventor finds that at least the following problems exist in the prior art: when the number of the clients corresponding to the session is large, the session management server needs to send the session messages to a large number of clients at the same time when sending the session messages each time, and the session management server has a large load and low communication efficiency.
Disclosure of Invention
In view of this, the present invention provides a method, an apparatus, a server and a readable storage medium for managing a session message, which solve the problems of a session management server in an IM system that a load is large and a communication efficiency is low to a certain extent.
In order to solve the technical problem, the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides a session message management method, where the method includes:
receiving a session message sent by a first client; the session message corresponds to a session pre-established between the first client and a plurality of second clients;
sending the session messages of which the number does not exceed the preset message number to a channel layer node, and controlling the channel layer node to send the session messages to the second client connected with the channel layer node;
the channel layer node is used for establishing communication connection between the first client and the second client and the session management server respectively; the preset message quantity is used for limiting the quantity of the session messages sent to the channel layer node.
In a second aspect, an embodiment of the present application provides a message management apparatus, including:
the receiving module is used for receiving the session message sent by the first client; the session message corresponds to a session pre-established between the first client and a plurality of second clients;
the sending module is used for sending the session messages of which the number is not more than the preset message number to a channel layer node and controlling the channel layer node to send the session messages to the second client connected with the channel layer node;
the channel layer node is used for establishing communication connection between the first client and the second client and the session management server respectively; the preset message quantity is used for limiting the quantity of the session messages sent to the channel layer node.
In a third aspect, embodiments of the present application provide a server, which includes a processor, a memory, and a program or instructions stored on the memory and executable on the processor, and when executed by the processor, implement the steps of the method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a program or instructions are stored, which when executed by a processor implement the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the method according to the first aspect.
In the embodiment of the application, the session management server receives the session message sent by the first client, sends the session message of which the number is not more than the preset message number to the channel layer node, and controls the channel layer node to send the session message to the second client connected with the channel layer node. When the session management server sends the session messages, the number of the session messages sent to the channel layer node does not exceed the preset message number, and when the number of the clients is large, the number of the session messages sent to the channel layer node by the session management server can be reduced, so that the load of the session management server can be reduced, and the communication efficiency can be improved.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a diagram illustrating session message management in the prior art;
FIG. 2 is a schematic diagram of a message subscription in the prior art;
fig. 3 is a flowchart illustrating steps of a session message management method according to an embodiment of the present application;
fig. 4 is a schematic diagram illustrating a session message management provided in an embodiment of the present application;
fig. 5 is a flowchart illustrating steps of a session message management method according to an embodiment of the present application;
fig. 6 is a schematic diagram of a message subscription provided in an embodiment of the present application;
fig. 7 is a block diagram of a message management apparatus according to an embodiment of the present application;
fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
For a clearer introduction of the present invention, a brief description will be first made of a session message management method in the related art.
As shown in fig. 1, fig. 1 is a schematic diagram of session message management in the prior art, where a session management server includes a service logic layer and a channel layer, the service logic layer is responsible for processing session messages, and the channel layer is responsible for communication between the session management server and a client. The channel layer may include a channel layer node 1, a channel layer node 2, and a channel layer node 3, and the session management server may configure different network addresses (IP) for each channel layer node, so that different clients may establish communication connection with the session management server through different channel layer nodes. For example, when receiving a communication establishment request sent by the client a, the session management server may establish a communication connection between the client a and the channel layer node 1, that is, establish a communication connection between the session management server and the client a, in response to the communication establishment request sent by the client a. Similarly, the session management server may establish a communication connection between the client B and the channel layer node 1, a communication connection between the client C and the client D and the channel layer node 2, and a communication connection between the client E and the client F and the channel layer node 3. The communication connection between the client A, the client B, the client C, the client D, the client E and the client F and the channel layer node is long-chain connection, and the communication connection between the client and the channel layer node is continuously kept. The session management server may distribute the clients among the plurality of channel layer nodes according to a load balancing principle, so that the number of clients connected to each channel layer node is the same or close.
Illustratively, the client a, the client B, the client C, the client D, the client E, and the client F are multiple clients corresponding to the same session. The client A is a first client for sending the session message, and the client C, the client D, the client E and the client F are second clients for receiving the session message. Conversational messages are data such as text, audio, video, and pictures. As shown in fig. 1, a thick solid line in fig. 1 is a path through which a session management server receives a session message, a thin solid line is a path through which the session management server sends the session message, after the session management server receives the session message sent by a client a through a channel layer node 1 and determines that a second client corresponding to a session includes a client B, a client C, a client D, a client E and a client F, the session management server can send the session message to the client B through the channel layer node 1, send the session message to the client C and the client B through a channel layer node 2, and send the session message to the client E and the client D through a channel layer node 3. When the session management server sends the session messages, the number of the session messages sent to the channel layer node is the same as the number of the second clients by taking the clients as dimensions. As shown in fig. 1, when sending session messages to the client C and the client D, the session management server needs to send two session messages to the channel layer node 2, that is, two thin solid lines corresponding to the channel layer node 2 in fig. 1. Therefore, when the number of the second clients is large, the session management server needs to send a large number of session messages to the channel layer node, which results in a large load on the session management server and low communication efficiency. The specific use method of the channel layer node may be set according to the requirement, and this embodiment does not limit this.
Meanwhile, after receiving the session message, the session management server stores the session message received at the current moment to obtain a history session message. After logging in the session management server, the user can operate the client to obtain the historical session message. As shown in fig. 2, fig. 2 is a schematic diagram of a message subscription in the prior art, after any client in a session sends a session message, a session management Server stores a copy of the session message in a caching middleware, such as a Remote Dictionary Server (Redis), to obtain a history session message. As shown in fig. 2, after the client a corresponding to the session establishes a communication connection with the session management server, the client a may send a subscription request to the session management server through a HyperText Transfer Protocol (HTTP), and the session management server may send a history session message stored in the cache middleware to the client a in response to the subscription request sent by the client a. In fig. 2, a solid line is a path of the session management server receiving the subscription request, a dotted line is a transmission path of the historical session message, and when the session management server stores the session message, the session management server stores only one session message for all the clients corresponding to the session. When the number of the clients corresponding to the session is large, a large number of clients simultaneously access a history session message, so that the session management server cannot process the subscription request of each client in time, and the performance of the session management server is reduced.
Fig. 3 is a flowchart of steps of a session message management method provided in an embodiment of the present application, and as shown in fig. 3, the method may include:
step 301, receiving a session message sent by a first client.
The session message corresponds to a session which is pre-established between the first client and the plurality of second clients.
In this embodiment, the session message management method may be executed by the session management server, and in the session establishment process, a session relationship for a plurality of session accounts may be established in the session management server in advance based on the plurality of session accounts. After the session relationship is established, among all accounts included in the session, a part of or all session accounts can log in the server through corresponding clients respectively, and the session capable of sending session messages to each other is established through a plurality of clients. The first client is a client sending the session message among the plurality of clients, and the second client is a client receiving the session message among the plurality of clients.
Illustratively, a user a may log in to a session management server through a client a using a session account a, and operate the client a to establish a session W in the session management server, the session W being, for example, a multi-person video conference, a chat room, or a multi-person chat group. After establishing the session W, the user a may operate the client a, add the session account B of the user B, the session account C of the user C, the session account D of the user D, and the session account E of the user E and the session account F of the user F to the session W, and obtain a session relationship including the session account a, the session account B, the session account C, the session account D, the session account E, and the session account F. The session account may be account information for identifying the user identity, which is obtained by registering the user in the session management server in advance. The specific establishment method of the session can be set according to the requirement, and the specific type of the session can include, but is not limited to, the session types of the multi-person video conference, the chat room, or the multi-person chat group, etc. as described above.
After the session relationship is established, the user can log in the server through the session account, and establish the communication connection between the client and the server, and when a plurality of clients establish the communication connection with the session management server at the same time, a plurality of users can send session messages to each other through the clients. For example, if user a logs in the session management server using client a, a communication connection between client a and the session management server is established, user B logs in the session management server using client B, a communication connection between client B and the session management server is established, user C logs in the session management server using client C, a communication connection between client C and the session management server is established, and user D logs in the session management server using client D, a communication connection between client D and the session management server is established. At this time, the session W corresponds to the client a, the client B, the client C, and the client D, the user a may input a session message in the client a (at this time, the client a is a sender of the session message, that is, a first client), and operate the client a to send the session message to the session management server, and the session management server may send the session message to the client B, the client C, and the client D after receiving the session message sent by the client a (the client B, the client C, and the client D are receivers of the session message, that is, a second client). The user E and the user F are not online because the user E and the user F do not log in the session management server by using the client, and the session accounts of the user E and the user F are offline session accounts; in contrast, the session accounts of user A, user B, user C, and user D are online session accounts.
In an embodiment, the client may send a session identifier of the session while sending the session message to the session management server, and the session management server may determine the session corresponding to the session message according to the session identifier. For example, the session message sent by the user a through the client a is a picture X, and when the client a sends the picture X to the session management server, the client a may send a session message data packet including the picture X and a session identifier W, where the session identifier W is identifier information of the session W. After receiving the session message data packet, the session management server may parse the session message data packet, obtain the picture X and the session identifier W in the session message data packet, and determine that the picture X corresponds to the session W according to the session identifier W. Further, it may be determined that the picture X is a session message sent by the client a to other clients corresponding to the session W.
In practical application, the session identifier may be established by the session management server according to the identifier information input by the user in the client when the session is established, and the specific type and the generation method of the session identifier and the sending method of the session message may be set according to requirements, which is not limited in this embodiment.
Step 302, sending session messages not exceeding the preset message quantity to the channel layer node, and controlling the channel layer node to send the session messages to a second client connected with the channel layer node.
The channel layer node is used for establishing communication connection between the first client and the second client and the session management server respectively; the preset message number is used for limiting the number of the session messages sent to the channel layer node.
In this embodiment, the channel layer may include one or more channel layer nodes, and when sending the session message to the second client, the session management server may first send the session message whose number does not exceed the preset message number to each channel layer node, and then control the channel layer nodes to send the session message to the second client connected to the channel layer nodes.
Exemplarily, as shown in fig. 4, fig. 4 is a schematic view of managing a session message according to an embodiment of the present application, in fig. 4, a thick solid line is a path for receiving the session message by the session management server, a thin solid line is a path for sending the session message by the session management server, and the preset number of messages is, for example, 2. In combination with step 301, when receiving a session message sent by the client a, the session management server first sends 1 or 2 session messages to the channel layer node 1, the channel layer node 2, and the channel layer node 3, respectively, and the number of the session messages sent to each channel layer node is not more than 2. Then, the control channel layer node 1 sends a session message to the client B connected to the control channel layer node 1, and controls the channel layer node 2 to send session messages to the client C and the client D connected to the control channel layer node 2, respectively. The client E and the client F do not establish a communication connection with the session management server, the channel layer node 3 is not connected to the second client, and the session management server may not send the session message to the channel layer node 3. Alternatively, the session message may be sent to the channel layer node 3, and the channel layer node 3 may ignore the session message after receiving the session message.
In one embodiment, the session management server may configure different client identifications, such as identification number (ID) of the client, for each client. For example, the session management server may generate, according to an Equipment Identity (IMEI) of the electronic device where the client is located, an ID for identifying an Identity of the client and a client identifier through a hash (hash) algorithm. The specific generation method and type of the client identifier may be set according to requirements, which is not limited in this embodiment.
The session management server can predetermine the client corresponding to the channel layer node, and establish and store the mapping relationship between the channel layer node and the client. In connection with the above example, the session management server may establish a first mapping list of the channel layer node 1, where the first mapping list corresponds to the session W. When the client a sends a communication establishment request to the session management server, the client a may send the communication establishment request including the session identifier W, and after receiving the communication establishment request, the session management server may analyze the communication establishment request to obtain the session identifier W, and when the session management server allocates the client a to the channel layer node 1 and establishes a communication connection between the channel layer node 1 and the client a, it may be determined that the channel layer node 1 is connected to the client a corresponding to the session W, and similarly, it may be determined that the channel layer node 1 is connected to the client B corresponding to the session W. At this time, the session management server may store the client identifications of the client a and the client B in the first mapping list of the channel layer node 1. Similarly, a first mapping list of the channel layer node 2 may be established.
In an embodiment, when receiving a session message sent by a first client, a session management server may first determine a session to which the session message belongs, and then determine a first mapping list of a channel layer node corresponding to the session. With reference to the above example, after receiving the session message data packet sent by the client a and analyzing the session identifier W, the session management server may determine the session W corresponding to the session message, determine the first mapping list of the channel layer node 1 corresponding to the session W according to the session identifier W, and determine that the channel layer node 1 is connected to the client a and the client B corresponding to the session W according to the client identifier in the first mapping list. Similarly, it may be determined that the channel layer node 2 is connected with the client C and the client D corresponding to the session W.
The session management server may control the channel layer node 1 to send the session message to the client B after sending the session message to the channel layer node 1 and determining the client a and the client B according to the first mapping list of the channel layer node 1. Similarly, after the session message is sent to the channel layer node 2 and the client C and the client D are determined according to the first mapping list of the channel layer node 2, the channel layer node 2 may be controlled to send the session message to the client C and the client D. The specific method for the session management server to control the channel layer node to send the session message to the second client connected to the channel layer node may be set according to the requirement, and this embodiment does not limit this. The client a is a first client, and the session management server may control the channel layer node not to send the session message to the first client.
In practical application, the specific value of the preset message number may be set according to requirements, for example, the preset message number may be 1, 2, 3, or 4 or other smaller integer values, and when the session management server sends the session message to the channel layer node, the session management server limits the number of the session messages sent to the channel layer node to not exceed the preset message number, so that a large number of session messages may be prevented from being sent to the channel layer node, and the load of the session management server is reduced. Referring to fig. 4, if the channel layer node 2 is connected with 100 second clients, the session management server needs to send 100 session messages to the channel layer node 2 if the sending method shown in fig. 1 is used. When the number of the session messages sent to the channel layer node 2 is limited to be not more than 2, the number of the session messages sent to the channel layer node 2 can be reduced, and the load of the session management server is reduced.
In summary, in this embodiment, the session management server receives the session message sent by the first client, sends the session message whose number does not exceed the preset message number to the channel layer node, and controls the channel layer node to send the session message to the second client connected to the channel layer node. When the session management server sends the session messages, the number of the session messages sent to the channel layer node does not exceed the preset message number, and when the number of the clients is large, the number of the session messages sent to the channel layer node by the session management server can be reduced, so that the load of the session management server can be reduced, and the communication efficiency can be improved.
Fig. 5 is a flowchart of steps of a session message management method provided in an embodiment of the present application, and as shown in fig. 5, the method may include:
step 501, receiving a session message sent by a first client.
Step 502, determining that the number of the second clients is greater than or equal to a preset target number.
When the number of the second clients is greater than or equal to the preset target number, it indicates that the session management server needs to send session messages to a large number of second clients when receiving the session messages sent by the first client, which may result in a large load on the session management server and a low communication efficiency.
In one embodiment, when receiving a session message sent by a first client, the session management server may first determine a session corresponding to the session message, and then may count the number of second clients corresponding to the session. With reference to the above example, after receiving the session message data packet sent by the client a and analyzing the session identifier W, the session management server may determine that the session message belongs to the session W, and may determine that the channel layer node 1 is connected to the client a and the client B corresponding to the session W according to the pre-stored first mapping list of the channel layer node 1. Similarly, it may be determined that the channel layer node 2 is connected with the client C and the client D corresponding to the session W, and at this time, the session management server may count that the number of all the second clients at the current time is 3. When the number of all the second clients is greater than or equal to the preset target number, the subsequent step 503 is executed, and a session message not exceeding the preset message number is sent to the channel layer node.
On the contrary, when the number of the clients corresponding to the session is smaller than the preset target number, it means that the session management server does not need to send the session messages to a large number of second clients when receiving the session messages sent by the first client. At this time, the session management server may transmit the session message to each of the second clients according to the session message transmission method shown in fig. 1.
In an embodiment, after receiving the session message and determining the session corresponding to the session message, the session management server may directly determine the number of all clients corresponding to the session, that is, the total number of the first client and the second client. And when the number of all the clients corresponding to the session is greater than the preset number of the clients, the number of the second clients is greater than or equal to the preset target number.
In practical application, when determining that the number of the second clients is greater than or equal to the preset target number, the session management server executes step 503, and sends a session message whose number does not exceed the preset message number to the channel layer node, so as to avoid the problem that the session management server is loaded greatly when the number of the clients in the session is large. Meanwhile, when the number of the second clients is smaller than the preset target number, the session message can be sent to the second clients by the method shown in fig. 1, so that the sending process of the session message can be simplified.
In one embodiment, the session management server may directly determine the number of session accounts in the session, and perform step 503 when the number of session accounts is greater than or equal to the preset number of session accounts. With reference to the foregoing example, the session management server may, during the process of establishing the session W, count all session accounts added to the session W, determine the total number of all session accounts in the session W, that is, the number of session accounts, and correspondingly store the session identifier of the session W and the corresponding number of session accounts. If the number of session accounts is greater than or equal to the preset number of session accounts, the server may directly perform step 503 when receiving the session message. In contrast, when the number of session accounts is less than the preset number of session accounts, the session message may be transmitted through the method shown in fig. 1.
The preset target number and the specific numerical value of the preset session account number may be specifically set according to the performance of the session management server, which is not limited in this embodiment.
Step 503, determining a target channel layer node from the plurality of channel layer nodes.
And the target channel layer node is a channel layer node connected with a second client.
And step 504, sending the session messages of which the number does not exceed the preset message number to the target channel layer node, and controlling the target channel layer node to send the session messages to a second client connected with the target channel layer node.
For example, as shown in fig. 4, the session management server may include a plurality of channel layer nodes, and before sending the session message, the session management server may first determine a target channel layer node to which the second client is connected, and then send the session message to the target channel layer node, where the number of the session message does not exceed a preset number of messages.
In an embodiment, the session management server may count all the channel layer nodes corresponding to the session in advance, and establish and store a mapping relationship between the session and the channel layer nodes. With reference to the foregoing example, the session management server may establish a second mapping list of the session W, and when the session management server establishes a communication connection between the channel layer node 1 and the client a, the session management server may determine that the channel layer node 1 is connected with the client corresponding to the session W. Similarly, it may be determined that the channel layer node 2 is connected with the client corresponding to the session W. At this time, the session management server may add the IP of the channel layer node 1 and the IP of the channel layer node 2 in the second mapping list to store the mapping relationship of the session W with the channel layer node 1 and the channel layer node 2.
After receiving the session message data packet sent by the client a and analyzing the session identifier W, the session management server may determine a second mapping list of the session W according to the session identifier W, and determine that the channel layer node 1 and the channel layer node 2 are connected with the client corresponding to the session W according to the IP of the channel layer node 1 and the IP of the channel layer node 2 in the second mapping list. The channel layer node 2 may be directly determined as the target channel layer node, and after it is determined that the channel layer node 1 is connected with the client B, the channel layer node 1 may be determined as the target channel layer node. At this time, the session management server may send 1 session message to the channel layer node 1 and the channel layer node 2, respectively. The channel layer node 1 and the channel layer node 2 may send the session message to the connected second client, respectively, upon receiving the session message. It should be noted that, when the number of the clients is large, each channel layer node is connected to multiple clients, and each channel layer node is connected to a second client.
In practical application, when the session management server sends the session message, the session management server only sends the session message to the channel layer node connected with the first client and/or the second client, and the session message can be prevented from being sent to all the channel layer nodes, so that the number of the session messages sent by the session management server to the channel layer nodes can be reduced, and the load of the session management server is further reduced.
In summary, in this embodiment, the session management server receives the session message sent by the first client, sends the session message whose number does not exceed the preset message number to the channel layer node, and controls the channel layer node to send the session message to the second client connected to the channel layer node. When the session management server sends the session messages, the number of the session messages sent to the channel layer node does not exceed the preset message number, and when the number of the clients is large, the number of the session messages sent to the channel layer node by the session management server can be reduced, so that the load of the session management server can be reduced, and the communication efficiency can be improved.
Optionally, the method may further include:
determining an offline session account that the session includes; the offline session account is a session account which is not logged in the session management server in the session accounts included in the session; the session account is used for establishing a session;
one session message is stored for each offline session account.
In this embodiment, the session management server may store a session message for each offline session account in the session, so as to subscribe to the historical session message of the offline session account after the offline session account logs in the session management server. Exemplarily, as shown in fig. 6, fig. 6 is a schematic diagram of a message subscription provided in an embodiment of the present application, a solid line in fig. 6 is a path of a session management server receiving a subscription request, and a dotted line is a sending path of a history session message. The session management server may count all offline session accounts in the session, so as to store one session message for each offline session account after receiving the session message, and obtain a corresponding historical session message. With the above example, when the client a sends a communication establishment request to the session management server, the client a may send a communication establishment request including the session account a, and the session management server may obtain the session account a of the user a through analysis. When establishing the communication connection between the channel layer node 1 and the client a, the session management server may determine that the client a is a client of a session account a, and the session account a is an online session account. Similarly, session account B, session account C, and session account D may be determined to be online session accounts. Conversely, session account E and session account F in the session other than session account a, session account B, session account C, and session account D may be determined to be offline session accounts. The session management server can count the online session accounts in the session in real time according to the currently established communication connection, and determine the offline session accounts according to all the session accounts and the online session accounts in the session.
With reference to the above example, after receiving the session message data packet sent by the client a and analyzing the session identifier W and the picture X, the session management server may first determine the offline session account E and the offline session account F in the session W according to the session identifier W, and store the picture X for the offline session account E and the offline session account F, respectively, to obtain the history session message of the offline session account E and the history session message of the offline session account F. Correspondingly, after logging in the session management server through the client E, the user E may send a subscription request to the session management server, and the session management server may determine the picture X from the historical session message of the session account E in response to the subscription request sent by the client E, and return the picture X to the client E. The specific process of the client subscribing to the historical session message from the session management server may be set according to requirements, and this embodiment does not limit this.
In practical applications, when the session management server stores the session message, the session management server may store a copy of the session message for each offline session account in the session. When a plurality of clients send subscription requests to the session management server at the same time, the session management server can provide historical session messages for the clients according to the historical session messages of the session accounts corresponding to the clients, so that the capability of the session management server in processing parallel data access can be improved, and the performance of the session management server can be improved. In addition, in the storage process of the historical session message, the historical session message is stored for an offline session account, and is not stored for an online session account, so that the data storage capacity can be reduced, and the storage pressure of the session management server can be reduced.
Optionally, before storing one session message for each offline session account, the method may further include:
determining that the number of offline session accounts is greater than or equal to a preset offline number.
In this embodiment, the session management server may store one session message for each offline session account when the number of the offline session accounts is greater than or equal to the preset offline number. Conversely, when the number of offline session accounts is less than the preset offline number, one session message may be stored for all offline session accounts. Fig. 2 shows a method for storing a session message for all offline session accounts, which is not described in detail in this embodiment.
In practical applications, when the number of the offline session accounts is greater than or equal to the preset offline number, a large number of users may be online at the same time, and a problem that a large number of clients access a piece of historical session information at the same time occurs, so that the session management server cannot process the subscription request of each client in time. On the contrary, when the number of the offline session accounts is smaller than the preset offline number and the offline users are online simultaneously, the number of the clients accessing the historical session messages is small, and the performance of the session management server is not reduced. At this time, only one session message can be stored, the user requirements can be met, and the storage pressure of the session management server can be reduced.
Optionally, the method may further include:
respectively storing a session message for each session account under the condition that the number of the session accounts included in the session is greater than or equal to the preset account number; the session account is used to establish a session.
In this embodiment, the session management server may store one session message for each session account. With reference to the above example, after the session management server receives the session message sent by the client a, one session message may be respectively stored for the session account a, the session account B, the session account C, the session account D, the session account E, and the session account F, so as to obtain historical session messages respectively belonging to the session account a, the session account B, the session account C, the session account D, the session account E, and the session account F.
In practical application, the session management server stores a session message for each session account, so that the historical session messages can be conveniently accessed after the session accounts are online. And when a large number of clients simultaneously access historical session messages, the method can avoid that the large number of clients simultaneously access one historical session message, can improve the capability of the session management server in processing parallel access, and improves the performance of the session management server.
Optionally, the method may further include:
when a subscription request sent by a subscription client is received, determining a subscription session account corresponding to the subscription client; the subscription request is used for acquiring a pre-stored session message;
if the session message for subscribing the session account is prestored, sending the session message for subscribing the session account to the subscribing client;
and if the session message of the subscription session account is not stored, sending the session messages of other session accounts except the subscription session account to the subscription client.
In this embodiment, the subscription client is a client accessing the historical session message, and the subscription session account is a session account corresponding to the subscription client. The session management server may send a pre-stored historical session message to the subscribing client when receiving a subscription request sent by the subscribing client. With reference to the foregoing example, after logging in the session management server by using the client E, the user E may access the picture X stored in advance for the session account E by the session management server.
When the session management server receives a subscription request sent by the client E, first determining a session account E corresponding to the client E, and then determining whether a historical session message of the session account E is stored according to the session account E. If the historical session message of the session account E is stored in advance, the session management server may send the picture X in the pre-stored historical session message to the client E. On the contrary, if the historical session message of the session account E is not stored, the session management server may determine the session account F storing the historical session message from among the session account F, the session account B, the session account C, and the session account E, and send the picture X in the historical session message of the session account F to the client E.
In practical application, after receiving a subscription request sent by a client, a session management server determines a session account corresponding to the client, determines a session message from historical session messages of the session account or determines a historical session message from historical session messages of other session accounts, returns the historical session message to the client, and can provide the historical session message for a user.
Fig. 7 is a block diagram of a message management apparatus according to an embodiment of the present application, and as shown in fig. 7, the apparatus 700 may include:
a receiving module 701, configured to receive a session message sent by a first client; the session message corresponds to a session which is pre-established between the first client and the plurality of second clients;
a first sending module 702, configured to send session messages to the channel layer node, where the number of the session messages does not exceed a preset message number, and control the channel layer node to send the session messages to a second client connected to the channel layer node;
the channel layer node is used for establishing communication connection between the first client and the second client and the session management server respectively; the preset message number is used for limiting the number of the session messages sent to the channel layer node.
In the embodiment of the application, the session message sent by the first client is received, the session message with the quantity not exceeding the preset message quantity is sent to the channel layer node, and the channel layer node is controlled to send the session message to the second client connected with the channel layer node. When the session management server sends the session messages, the number of the session messages sent to the channel layer node does not exceed the preset message number, and when the number of the clients is large, the number of the session messages sent to the channel layer node by the session management server can be reduced, so that the load of the session management server can be reduced, and the communication efficiency can be improved.
Optionally, the number of the channel layer nodes is multiple, and the sending module 702 is specifically configured to determine a target channel layer node from the multiple channel layer nodes; the target channel layer node is a channel layer node connected with a second client;
and sending session messages of which the number does not exceed the preset message number to the target channel layer node, and controlling the target channel layer node to send the session messages to a second client connected with the target channel layer node.
Optionally, the apparatus 700 may further include:
and the first determining module is used for determining that the number of the second clients is greater than or equal to the preset target number.
Optionally, the apparatus 700 may further include:
a second determining module, configured to determine an offline session account included in the session; the offline session account is a session account which is not logged in the session management server in the session accounts included in the session; the session account is used for establishing a session;
the first storage module is used for storing a session message for each offline session account.
Optionally, the apparatus 700 may further include:
and the third determining module is used for determining that the number of the offline session accounts is greater than or equal to the preset offline number.
Optionally, the apparatus 700 may further include:
the second storage module is used for respectively storing a session message for each session account under the condition that the number of the session accounts included in the session is greater than or equal to the preset account number; the session account is used to establish a session.
Optionally, the apparatus 700 may further include:
the third determining module is used for determining a subscription session account corresponding to the subscription client when receiving a subscription request sent by the subscription client; the subscription request is used for acquiring a pre-stored session message;
the second sending module is used for sending the session message of the subscription session account to the subscription client if the session message of the subscription session account is stored in advance;
and the third sending module is used for sending the session messages of other session accounts except the subscription session account to the subscription client if the session messages of the subscription session account are not stored.
The message management device provided by the embodiment of the application has the corresponding functional module for executing the session message management method, can execute the session message management method provided by the embodiment of the application, and can achieve the same beneficial effects.
In another embodiment provided by the present invention, there is also provided a server, where the server may include: the processor implements each process of the above-mentioned session message management method embodiment when executing the program, and can achieve the same technical effect, and is not described herein again in order to avoid repetition.
For example, as shown in fig. 8, fig. 8 is a schematic diagram of a hardware structure of an electronic device provided in an embodiment of the present application, where the electronic device specifically includes: a processor 801, a storage device 802, a display screen with touch functionality 803, an input device 804, an output device 805, and a communication device 806. The number of the processors 801 in the electronic device may be one or more, and one processor 801 is taken as an example in fig. 8. The processor 801, the storage means 802, the display 803, the input means 804, the output means 805 and the communication means 806 of the electronic device may be connected by a bus or other means.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, which stores instructions that, when executed on a computer, cause the computer to execute the session message management method described in any of the above embodiments.
In yet another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method for session message management as described in any of the above embodiments.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A session message management method is applied to a session management server, and comprises the following steps:
receiving a session message sent by a first client; the session message corresponds to a session pre-established between the first client and a plurality of second clients;
sending the session messages of which the number does not exceed the preset message number to a channel layer node, and controlling the channel layer node to send the session messages to the second client connected with the channel layer node;
the channel layer node is used for establishing communication connection between the first client and the second client and the session management server respectively; the preset message quantity is used for limiting the quantity of the session messages sent to the channel layer node.
2. The method according to claim 1, wherein the number of the channel layer nodes is plural, and the sending of the session message to a channel layer node, which does not exceed a preset number of messages, and controlling the channel layer node to send the session message to the second client connected to the channel layer node comprises:
determining a target channel layer node from a plurality of the channel layer nodes; the target channel layer node is a channel layer node connected with the second client;
and sending the session message of which the number does not exceed the preset message number to the target channel layer node, and controlling the target channel layer node to send the session message to the second client connected with the target channel layer node.
3. The method of claim 1, wherein before sending the session message to the channel layer node not more than a preset number of messages, further comprising:
and determining that the number of the second clients is greater than or equal to a preset target number.
4. The method of claim 1, further comprising:
determining an offline session account that the session includes; the offline session account is a session account which is not logged in the session management server in the session accounts included in the session; the session account is used for establishing the session;
and respectively storing one piece of the session message for each offline session account.
5. The method of claim 4, further comprising, before storing a respective copy of the session message for each of the offline session accounts:
and determining that the number of the offline session accounts is greater than or equal to a preset offline number.
6. The method of claim 1, further comprising:
respectively storing one session message for each session account under the condition that the number of the session accounts included in the session is greater than or equal to the preset account number; the session account is used to establish the session.
7. The method according to any one of claims 4-6, further comprising:
when a subscription request sent by a subscription client is received, determining a subscription session account corresponding to the subscription client; the subscription request is used for acquiring the pre-stored session message;
if the session message of the subscription session account is prestored, sending the session message of the subscription session account to the subscription client;
and if the session message of the subscription session account is not stored, sending the session messages of other session accounts except the subscription session account to the subscription client.
8. A session message management apparatus provided in a session management server, the apparatus comprising:
the receiving module is used for receiving the session message sent by the first client; the session message corresponds to a session pre-established between the first client and a plurality of second clients;
the first sending module is used for sending the session messages of which the number is not more than the preset message number to a channel layer node and controlling the channel layer node to send the session messages to the second client connected with the channel layer node;
the channel layer node is used for establishing communication connection between the first client and the second client and the session management server respectively; the preset message quantity is used for limiting the quantity of the session messages sent to the channel layer node.
9. A server, comprising a processor, a memory, and a program or instructions stored on the memory and executable on the processor, the program or instructions when executed by the processor implementing the steps of the session message management method according to any one of claims 1-7.
10. A readable storage medium, on which a program or instructions are stored, which when executed by a processor, implement the steps of the session message management method according to any one of claims 1-7.
CN202011595184.2A 2020-12-28 2020-12-28 Session message management method, device, server and readable storage medium Active CN112751748B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011595184.2A CN112751748B (en) 2020-12-28 2020-12-28 Session message management method, device, server and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011595184.2A CN112751748B (en) 2020-12-28 2020-12-28 Session message management method, device, server and readable storage medium

Publications (2)

Publication Number Publication Date
CN112751748A true CN112751748A (en) 2021-05-04
CN112751748B CN112751748B (en) 2023-04-18

Family

ID=75646836

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011595184.2A Active CN112751748B (en) 2020-12-28 2020-12-28 Session message management method, device, server and readable storage medium

Country Status (1)

Country Link
CN (1) CN112751748B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726878A (en) * 2021-08-30 2021-11-30 深圳追一科技有限公司 Session processing method, system, device and storage medium in cluster environment
CN113794939A (en) * 2021-07-30 2021-12-14 北京达佳互联信息技术有限公司 Data processing method and device, electronic equipment and computer readable storage medium
CN114584602A (en) * 2022-03-01 2022-06-03 百果园技术(新加坡)有限公司 Session state management method, system, device, equipment and storage medium
CN114827065A (en) * 2022-04-28 2022-07-29 抖动科技(深圳)有限公司 Real-time communication method based on unified communication channel and related equipment
CN115118772A (en) * 2022-06-21 2022-09-27 壹沓科技(上海)有限公司 Message communication system and method

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6088728A (en) * 1997-06-11 2000-07-11 Oracle Corporation System using session data stored in session data storage for associating and disassociating user identifiers for switching client sessions in a server
JP2003242057A (en) * 2002-02-14 2003-08-29 Nippon Telegr & Teleph Corp <Ntt> Load dispersing method and device therefor
EP1439674A2 (en) * 2003-01-20 2004-07-21 Avaya Technology Corp. Messaging advice in presence-aware networks
US20060129641A1 (en) * 2004-12-15 2006-06-15 France Telecom Method of limiting the number of simultaneous conversations in an instant messaging system
US20100216500A1 (en) * 2009-02-25 2010-08-26 Research In Motion Limited Systems and methods for facilitating push-to-talk (ptt) communications using sip-based messaging
CN103428070A (en) * 2012-05-17 2013-12-04 阿里巴巴集团控股有限公司 Instant group messaging method, session management server and client side
CN105635180A (en) * 2016-03-04 2016-06-01 广州酷狗计算机科技有限公司 Message pushing method and device
WO2017219848A1 (en) * 2016-06-22 2017-12-28 中兴通讯股份有限公司 Id processing method in distributed database, management system, and server
KR20180113080A (en) * 2017-04-05 2018-10-15 라인 가부시키가이샤 Method and system for data transmitting
CN111651281A (en) * 2020-04-27 2020-09-11 北京中交兴路信息科技有限公司 Message publishing and subscribing method and system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6088728A (en) * 1997-06-11 2000-07-11 Oracle Corporation System using session data stored in session data storage for associating and disassociating user identifiers for switching client sessions in a server
JP2003242057A (en) * 2002-02-14 2003-08-29 Nippon Telegr & Teleph Corp <Ntt> Load dispersing method and device therefor
EP1439674A2 (en) * 2003-01-20 2004-07-21 Avaya Technology Corp. Messaging advice in presence-aware networks
US20060129641A1 (en) * 2004-12-15 2006-06-15 France Telecom Method of limiting the number of simultaneous conversations in an instant messaging system
US20100216500A1 (en) * 2009-02-25 2010-08-26 Research In Motion Limited Systems and methods for facilitating push-to-talk (ptt) communications using sip-based messaging
CN103428070A (en) * 2012-05-17 2013-12-04 阿里巴巴集团控股有限公司 Instant group messaging method, session management server and client side
CN105635180A (en) * 2016-03-04 2016-06-01 广州酷狗计算机科技有限公司 Message pushing method and device
WO2017219848A1 (en) * 2016-06-22 2017-12-28 中兴通讯股份有限公司 Id processing method in distributed database, management system, and server
KR20180113080A (en) * 2017-04-05 2018-10-15 라인 가부시키가이샤 Method and system for data transmitting
CN111651281A (en) * 2020-04-27 2020-09-11 北京中交兴路信息科技有限公司 Message publishing and subscribing method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
曹海涛等: "基于集群节点间即时拷贝的会话同步技术研究", 《计算机系统应用》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113794939A (en) * 2021-07-30 2021-12-14 北京达佳互联信息技术有限公司 Data processing method and device, electronic equipment and computer readable storage medium
CN113726878A (en) * 2021-08-30 2021-11-30 深圳追一科技有限公司 Session processing method, system, device and storage medium in cluster environment
CN114584602A (en) * 2022-03-01 2022-06-03 百果园技术(新加坡)有限公司 Session state management method, system, device, equipment and storage medium
CN114584602B (en) * 2022-03-01 2023-08-29 百果园技术(新加坡)有限公司 Session state management method, system, device, equipment and storage medium
CN114827065A (en) * 2022-04-28 2022-07-29 抖动科技(深圳)有限公司 Real-time communication method based on unified communication channel and related equipment
CN114827065B (en) * 2022-04-28 2024-02-23 抖动科技(深圳)有限公司 Real-time communication method based on unified communication channel and related equipment
CN115118772A (en) * 2022-06-21 2022-09-27 壹沓科技(上海)有限公司 Message communication system and method

Also Published As

Publication number Publication date
CN112751748B (en) 2023-04-18

Similar Documents

Publication Publication Date Title
CN112751748B (en) Session message management method, device, server and readable storage medium
US9578081B2 (en) System and method for providing an actively invalidated client-side network resource cache
US10771552B2 (en) Content management
US8023498B2 (en) Controlling access to a destination in a data processing network
US20110264777A1 (en) Communications device and method
CN112769837B (en) Communication transmission method, device, equipment, system and storage medium based on WebSocket
US20050091653A1 (en) Method and apparatus for load sharing and data distribution in servers
CN111988387B (en) Interface request processing method, device, equipment and storage medium
CN111679916B (en) Video recommendation method, target service providing terminal, service calling terminal and system
CN113315689B (en) Information processing method, system, electronic device and readable storage medium
CN111711675B (en) Solution for concurrent message transmission in local area network
US10938993B2 (en) Workload balancing technique for a telephone communication system
CN114268631B (en) Low-delay network system, communication connection method thereof and readable storage medium
KR100297256B1 (en) Method for processing subscriber management request dispersively in intelligent network service system applying client-server model
EP1806904A1 (en) Method for managing electronic information, the related user terminal and the related information source
WO2024098748A1 (en) Communication method and system, and client, gateway device and global server load balance device
CN115086292A (en) Distributed instant server push scheme architecture design method, device and storage medium
JP2018133024A (en) Service providing server, service providing method, and service providing program
Alves et al. Adaptable consistency requirements for efficient large-scale multi-user chat

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant