CN110708237A - Message interaction method and device, readable medium and electronic equipment - Google Patents

Message interaction method and device, readable medium and electronic equipment Download PDF

Info

Publication number
CN110708237A
CN110708237A CN201911046890.9A CN201911046890A CN110708237A CN 110708237 A CN110708237 A CN 110708237A CN 201911046890 A CN201911046890 A CN 201911046890A CN 110708237 A CN110708237 A CN 110708237A
Authority
CN
China
Prior art keywords
message
identifier
live broadcast
index table
client
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.)
Pending
Application number
CN201911046890.9A
Other languages
Chinese (zh)
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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN201911046890.9A priority Critical patent/CN110708237A/en
Publication of CN110708237A publication Critical patent/CN110708237A/en
Priority to PCT/CN2020/106907 priority patent/WO2021082584A1/en
Pending legal-status Critical Current

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]
    • H04L51/046Interoperability with other network applications or services
    • 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/07User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
    • H04L51/10Multimedia 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/214Monitoring or handling of messages using selective forwarding
    • 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/52User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail for supporting social networking services

Abstract

The disclosure relates to a message interaction method, a message interaction device, a readable medium and electronic equipment. When the message interaction method is applied to a server, the server stores a plurality of index tables, each index table reflects the corresponding relation between the message identification and the storage position of all messages in a live broadcast room, and the method comprises the following steps: receiving a reading request which is sent by a client and comprises a message identifier and a live broadcast room identifier; acquiring a target index table according to the live broadcast room identifier, wherein the target index table is an index table corresponding to the live broadcast room identifier; reading a message set according to the message identifier and the target index table; and sending the message set to the client. According to the technical scheme, the pull model is adopted when the client and the server perform message interaction, namely the client actively queries the server and acquires the message by sending the read request comprising the message identifier and the live broadcast room identifier, so that the condition that a user acquires the latest message timely and without loss in a live broadcast scene of a large-scale user on line at the same time can be met, and the live broadcast interaction experience is improved.

Description

Message interaction method and device, readable medium and electronic equipment
Technical Field
The present disclosure relates to the field of communications technologies, and in particular, to a message interaction method, an apparatus, a readable medium, and an electronic device.
Background
The traditional instant messaging technical scheme based on the close relation chat group generally adopts a push model. However, the push model is poor in applicability to a scene based on a loose chat group (users can go in and out at any time) like live broadcast, and a large-scale user is in a chat group (live broadcast room) at the same time, and cannot meet the requirements of timely acquiring messages and not losing the messages.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, the present disclosure provides a message interaction method applied to a server, where the server stores multiple index tables, and each index table reflects a correspondence between message identifiers of all messages in a live broadcast room and storage locations of all messages in the live broadcast room, where the method includes:
receiving a reading request sent by a client, wherein the reading request comprises a message identifier and a live broadcast room identifier;
acquiring a target index table according to the live broadcast room identification, wherein the target index table is an index table corresponding to the live broadcast room identification;
reading a message set according to the message identifier and the target index table;
and sending the message set to the client.
In a second aspect, the present disclosure provides a message interaction method applied to a client, where the method includes:
sending a reading request to a server, wherein the reading request comprises a message identifier and a live broadcast room identifier;
and receiving and displaying a message set sent by the server, wherein the message set is read by the server according to the message identifier and a target index table, and the target index table is an index table corresponding to the live broadcast room identifier.
In a third aspect, the present disclosure provides a message interaction apparatus applied to a server, where the server stores a plurality of index tables, and each index table reflects a correspondence between message identifiers of all messages in a live broadcast room and storage locations of all messages in the live broadcast room, and the apparatus includes:
the reading request receiving module is used for receiving a reading request sent by a client, and the reading request comprises a message identifier and a live broadcast room identifier;
a target index table obtaining module, configured to obtain a target index table according to the live broadcast room identifier, where the target index table is an index table corresponding to the live broadcast room identifier;
the message set reading module is used for reading a message set according to the message identifier and the target index table;
and the message set sending module is used for sending the message set to the client.
In a fourth aspect, the present disclosure provides a message interaction apparatus, applied to a client, including:
the reading request sending module is used for sending a reading request to the server, wherein the reading request comprises a message identifier and a live broadcast room identifier;
and the message set receiving module is used for receiving and displaying a message set sent by the server, wherein the message set is read by the server according to the message identifier and a target index table, and the target index table is an index table corresponding to the live broadcast room identifier.
In a fifth aspect, the present disclosure provides a computer readable medium having stored thereon a computer program which, when executed by a processing apparatus, performs the steps of the method of the first and second aspects.
In a sixth aspect, the present disclosure provides an electronic device applied to a server, including:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to carry out the steps of the method of the first aspect.
In a seventh aspect, the present disclosure provides an electronic device, applied to a client, including:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to carry out the steps of the method of the second aspect.
According to the technical scheme, the pull model is adopted when the client and the server perform message interaction, namely the client actively queries and acquires the message from the server by sending the read request comprising the message identifier and the live broadcast room identifier.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale. In the drawings:
fig. 1 is a flow diagram illustrating a message interaction method according to one embodiment.
FIG. 2 is a diagram illustrating relationships among a live room, a circular chain table, and an index table, according to an embodiment.
Fig. 3 is a flow diagram illustrating another message interaction method according to another embodiment.
Fig. 4 is a block diagram illustrating a message interaction device, according to an embodiment.
Fig. 5 is a block diagram illustrating another message interaction device, according to another embodiment.
FIG. 6 is a block diagram illustrating an electronic device in accordance with one embodiment.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "an embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
An embodiment of the present disclosure provides a message interaction method. The message interaction method is applied to a server, a plurality of index tables are stored in the server, and each index table reflects the corresponding relation between the message identification of all messages in a live broadcast room and the storage position of all messages in the live broadcast room. Fig. 1 is a flowchart illustrating a message interaction method according to an embodiment of the present disclosure. As shown in fig. 1, the method comprises the steps of:
step S11, receiving a read request sent by the client, where the read request includes a message identifier and a live broadcast room identifier.
The message identification is the only identification of the message, and the message identification corresponds to the message one to one. The live broadcast room identification is the only identification of the live broadcast room, and the live broadcast room identification corresponds to the live broadcast room one by one. The live broadcast room is a live broadcast room of the live broadcast platform.
And step S13, acquiring a target index table according to the live broadcast room identification, wherein the target index table is an index table corresponding to the live broadcast room identification.
Each index table is used for searching the messages of each live broadcast room, and the index tables correspond to the live broadcast rooms one by one. Therefore, the index table corresponds to the live broadcast room identifier one by one, and the index table corresponding to the live broadcast room identifier can be obtained through the live broadcast room identifier, namely, the target index table can be obtained according to the live broadcast room identifier.
Step S15, reading a message set according to the message identifier and the target index table.
And reading a message set of the live broadcast room corresponding to the live broadcast room identification according to the relation between the content of the message identification and a preset rule and the target index table.
And step S17, sending the message set to the client.
According to the technical scheme, the pull model is adopted when the client and the server carry out message interaction, namely the client actively queries the server and acquires messages by sending the read request comprising the message identification and the live broadcast room identification, and under the condition that the pull model is used, the condition that a large-scale user acquires the latest messages timely and without loss in a live broadcast scene at the same time can be met, and the live broadcast interaction experience is improved.
Optionally, in an embodiment, the message identifier in the read request is a message identifier of a last message in a message set that is read by the client from the server last time, and step S15 specifically includes: and acquiring the storage position of the message corresponding to the message identifier according to the target index table, and reading the messages stored in the storage positions within a first preset number behind the storage position to obtain the message set. The method further comprises the following steps: and sending the read message identifier of the last message in the message set to the client so that the client can initiate the next reading request according to the message identifier.
And when the message identifier in the read request is the message identifier of the last message in the message set read by the client from the server last time, the message identifier in the read request is the same as a message identifier in the target index table. And the target index table reflects the corresponding relation between the message identifiers of all messages in the live broadcast room accessed by the client and the storage positions of all messages in the live broadcast room, so that the storage positions of the messages corresponding to the message identifiers in the read request can be obtained according to the target index table and the message identifiers in the read request. The first preset number may be sent when the client sends the read request, that is, the read request further includes the first preset number; the message identifier may be set in a server, and the server, receiving the message identifier in this embodiment, returns the messages stored in the storage location after the storage location by a first preset number according to a preset rule. The message corresponding to the message identifier in the current read request may already be a newer message in the existing messages in the live broadcast room, and when the latest message stored in the live broadcast room is less than the first preset number from the message corresponding to the message identifier in the current read request (excluding the message corresponding to the message identifier in the current read request), the message after the message corresponding to the message identifier in the current read request is read (which is less than the first preset number) to obtain the message set. When the number of the latest messages stored in the live broadcast room from the message corresponding to the message identifier in the current reading request (excluding the message corresponding to the message identifier in the current reading request) is not less than the first preset number, reading the messages which are behind the message corresponding to the message identifier in the current reading request and have the first preset number, and obtaining the message set. And the last message in the message set is the latest message in the message set.
According to the technical scheme, for the message of a live broadcast room, the client initiates a reading request according to the message identifier of the latest message in the message set read from the server last time, obtains the message set of a first preset number of messages (newer than the latest message) after the latest message from the server, and obtains the message identifier of the latest message in the message set, and initiates the reading request by using the message identifier of the latest message in the message set when the client reads the request next time, so that the reading request is repeatedly executed, and the updated message of the live broadcast room can be actively obtained from the server without repetition and loss.
Optionally, in an embodiment, the message identifier in the read request is null, and step S15 specifically includes: and acquiring a storage position of a message corresponding to the message identifier at the tail end in the target index table according to the target index table, and reading messages stored in the storage position and the previous storage positions within a second preset number to obtain the message set. The method further comprises the following steps: and sending the read message identifier of the last message in the message set to the client so that the client can initiate the next reading request according to the message identifier.
When the message identifier in the read request is empty, for example, the client enters the live broadcast room for the first time. And the last message identifier in the target index table corresponding to the live broadcast room is the message identifier corresponding to the latest message in the existing messages in the live broadcast room. Step S15 may indicate that, when the client enters the live broadcast room for the first time, the server returns the latest message in the existing messages in the live broadcast room and the messages within the second preset number before the latest message to the client as a message set. The second preset number may be sent when the client sends the read request, that is, the read request further includes the second preset number; or the message may be set in the server, and when the server receives an empty message identifier in this embodiment, the server returns, according to a preset rule, messages stored in a second preset number of storage locations before the storage location of the message corresponding to the last message identifier in the target index table. And when the number of the existing messages in the live broadcast room is less than or equal to a second preset number, reading the message corresponding to the message identifier at the tail end in the target index table and all the messages (less than the second preset number) before the message to obtain the message set. And when the number of the existing messages in the live broadcast room is larger than a second preset number, reading the message corresponding to the message identifier at the tail end in the target index table and the messages with the second preset number before the message to obtain the message set. The last message in the message set is the latest message in the message set, and for this reason, the last message in the target index table identifies the corresponding message.
According to the technical scheme, for the message in a live broadcast room, when a client enters the live broadcast room for the first time, the client initiates a reading request with a message identifier being null, a message set consisting of the latest message in the existing message in the live broadcast room and the message within a second preset number before the latest message is obtained from a server, the message identifier of the latest message in the existing message in the live broadcast room is obtained, and the reading request can be initiated by using the message identifier of the latest message in the existing message in the live broadcast room when the reading request is carried out next time, so that the reading request can be repeatedly executed. Therefore, according to the technical scheme, when the client enters the live broadcast room for the first time, the message set formed by the messages in the latest period of time (the latest second preset number is less than 1) in the live broadcast room at the moment and the message identifier of the latest message in the live broadcast room at the moment are obtained, and the next reading request is initiated according to the message identifier of the latest message in the live broadcast room at the moment when the next reading request is carried out, so that the updated message in the live broadcast room can be actively obtained from the server without repetition and loss.
Optionally, in an embodiment, a message identifier in the read request is different from any message identifier in the target index table, and step S15 specifically includes: and acquiring a storage position of a message corresponding to the message identifier at the tail end in the target index table according to the target index table, and reading messages stored in the storage position and the previous storage positions within a second preset number to obtain the message set. The method further comprises the following steps: and sending the read message identifier of the last message in the message set to the client so that the client can initiate the next reading request according to the message identifier.
When the message identifier in the read request is different from any message identifier in the target index table, it may be that the message identifier in the read request sent by the client is wrong; it may also be that the message identification in the read request sent by the client is the message identification of an earlier previous message of the live broadcast room, which has not been stored due to being covered by a new message or the like or whose message identification is not stored in the target index table corresponding to the live broadcast room. In this embodiment, the processing mode after the message identifier in the read request received by the server is different from any message identifier in the target index table is the same as the processing mode after the message identifier in the read request received by the server is empty, and thus the detailed description is omitted here.
Through the technical scheme, when the message identifier in the sent reading request is wrong or the message identifier in the sent reading request is the message identifier of the earlier and former message in the live broadcast, the client can actively acquire the updated message in the live broadcast from the server without repetition and loss.
Optionally, the method further comprises: and after receiving the read request sent by the client, sending request interval time to the client, wherein the request interval time is the interval time between the next time of sending the read request and the current time of sending the read request by the client.
Through the technical scheme, the server can control the interval time of the client sending the read request through the request interval time. Therefore, when the server senses that the pressure is too high, such as the CPU of the server is too high and the flow of the network card is too large, the request interval time sent to the plurality of clients is properly increased, so that the concurrence number of the requests of the clients is reduced to a certain extent. In addition, when the server perceives that the stress is small or constant, the request interval sent to the client may be reduced or unchanged as appropriate.
Optionally, before the step of sending the request interval time to the client, the method further comprises: and when the perceived pressure is larger than the preset value, increasing the request interval time.
The server sensing pressure can be determined in a server CPU, network card flow and other modes, and correspondingly, the preset value is also determined according to the server sensing pressure mode. For example, whether the server senses that the pressure is greater than the preset value is determined by determining whether the CPU of the server is greater than the preset value, which may be set according to experience or by the user, and is not limited herein. When the server senses that the pressure is too large, the request interval time sent to the client is properly increased, so that the concurrency number of client requests is reduced to a certain extent.
Optionally, the method further comprises: and receiving a write request sent by a client, wherein the write request comprises a written message and a live broadcast room identifier. According to the live broadcast room identification, the message is written into the pointed element of the pointer of the target circular linked list, the target circular linked list is the circular linked list corresponding to the live broadcast room identification, the circular linked list is an array comprising a plurality of elements, each element is used for storing a message, the pointer of the circular linked list moves from the pointed initial element to the pointed tail element along with the writing of the message in sequence, and when the pointer points, the next movement after the tail element points again to the initial element. And generating the identification information of the message according to the time of receiving the write request. And storing the identification information and the storage position of the message to the target index table, wherein the storage position points to a specific element of a target circular linked list for storing the message.
Each circular linked list is used for storing messages of a live broadcast room, and the circular linked lists are in one-to-one correspondence with the live broadcast rooms. The message identification and the storage position of the message stored in each circular linked list are stored in an index table, and the circular linked lists are in one-to-one correspondence with the index table. In order to explain the above technical solutions more clearly, fig. 2 is used for illustration. In fig. 2, room1 represents the first live room; RingBuffer1 represents the corresponding circular linked list of the first live broadcast room; each cell in RingBuffer1 represents an element of the circular linked list for storing a message, e.g., msg1, msg2, msg3 … msg1000 in RingBuffer1 in fig. 2 represents a message stored in RingBuffer1 and also represents a message of the first live broadcast stored in sequence; an arrow pointing to the RingBuffer1 represents a pointer which initially points to the starting element of RingBuffer1, namely to the first lattice of RingBuffer1, after the server receives a write request sent by a client, the server writes a message included in the write request into the first lattice of RingBuffer1, the pointer points to the second lattice of RingBuffer1, and so on, the pointer moves from the starting element to the last element (the last lattice) in sequence with the writing of the message, and when the pointer points to the last element, the pointer moves to the starting element again next time (at this time, when the pointer points to the starting element again, the message newly written into the starting element overwrites the message originally in the starting element); msg _ index1 represents an index table corresponding to the first live broadcast, on which the correspondence relationship between the message identifier of each message stored in RingBuffer1 and the storage location of the message is stored, the storage location points to the specific element of RingBuffer1 storing the message, for example, msg _ id1 located in msg _ index1 in fig. 2 represents the message identifier of message msg1 in RingBuffer1, pos1 located in msg _ index1 represents the storage location of message msg1 in RingBuffer1, and pos1 in msg _ index1 points to the first lattice (start element) of RingBuffer 1. Similarly, room2 represents a second live room; RingBuffer2 represents the corresponding circular linked list of the second live broadcast room; each lattice in RingBuffer2 represents an element of the circular linked list for storing a message, e.g., msg1 ', msg 2', msg3 '… msg 1000' in RingBuffer2 in fig. 2 represents a message stored in the RingBuffer2 and also represents a message of the second live broadcast which is stored in sequence; an arrow pointing to the RingBuffer2 represents a pointer which initially points to the starting element of RingBuffer2, namely to the first lattice of RingBuffer2, after the server receives a write request sent by a client, the server writes a message included in the write request into the first lattice of RingBuffer2, the pointer points to the second lattice of RingBuffer2, and so on, the pointer moves from the starting element to the last element (the last lattice) in sequence with the writing of the message, and when the pointer points to the last element, the pointer moves to the starting element again next time (at this time, when the pointer points to the starting element again, the message newly written into the starting element overwrites the message originally in the starting element); msg _ index2 represents an index table corresponding to the second live broadcast, on which the correspondence relationship between the message identifier of each message stored in RingBuffer2 and the storage location of the message is stored, the storage location points to the specific element of RingBuffer2 storing the message, for example, msg _ id1 ' located in msg _ index2 in fig. 2 represents the message identifier of message msg1 ' in RingBuffer2, pos1 ' located in msg _ index2 represents the storage location of message msg1 ' in RingBuffer2, and pos1 ' in msg _ index2 points to the first lattice (start element) of RingBuffer 2.
Through the technical scheme, the data structure of the circular linked list is defined, the message of each live broadcast room is stored in the circular linked list, the indexing is carried out through the corresponding index table, and the message reading performance is good.
Optionally, in an embodiment, the circular linked list is an array including 1000 elements. That is, for messages in a live broadcast room, only the latest 1000 messages can be stored, and messages older than the 1000 messages can be covered, so that the memory is saved.
Based on the above inventive concept, another embodiment of the present disclosure further provides a message interaction method, which is applied to a client. Fig. 3 is a flow chart illustrating a message interaction method according to an embodiment of the present disclosure. As shown in fig. 3, the method comprises the steps of:
step S31, sending a reading request to the server, wherein the reading request comprises a message identification and a live broadcast identification.
Step S33, receiving and displaying a message set sent by the server, where the message set is read by the server according to the message identifier and a target index table, and the target index table is an index table corresponding to the live broadcast room identifier.
According to the technical scheme, the pull model is adopted when the client and the server carry out message interaction, namely the client actively queries the server and acquires messages by sending the read request comprising the message identification and the live broadcast room identification, and under the condition that the pull model is used, the condition that a large-scale user acquires the latest messages timely and without loss in a live broadcast scene at the same time can be met, and the live broadcast interaction experience is improved.
Optionally, in an embodiment, the message identifier in the read request is a message identifier of a last message in a message set that is read by the client from the server last time, and the message set in step S33 is a message stored in a storage location within a first preset number after a storage location of a message corresponding to the message identifier. The method further comprises the following steps: and receiving the message identifier of the last message in the message set sent by the server, and updating the message identifier in the read request according to the message identifier so as to initiate the next read request according to the message identifier.
Through the technical scheme, for the messages in a live broadcast room, the client initiates a read request according to the message identifier of the latest message (the message at the tail end in the message set) in the message set read from the server last time, acquires the message set of the first preset number of messages (newer than the latest message) after the latest message from the server, and acquires the message identifier of the latest message in the message set, and initiates the read request by using the message identifier of the latest message in the message set when the client reads the message in the next time, so that the read request is repeatedly executed, and the updated messages in the live broadcast room can be actively acquired from the server without repetition or loss.
Optionally, in an embodiment, the message identifier in the read request is null, and the message set in step S33 is a message stored in the storage location corresponding to the last message identifier in the target index table and a storage location within a second preset number before the storage location. The method further comprises the following steps: and receiving the message identifier of the last message in the message set sent by the server, and updating the message identifier in the read request according to the message identifier so as to initiate the next read request according to the message identifier.
According to the technical scheme, for the message in a live broadcast room, when a client enters the live broadcast room for the first time, the client initiates a read request with a message identifier being null, acquires a message set consisting of a latest message (a message corresponding to the latest message identifier in the target index table) in the existing message in the live broadcast room and messages within a second preset number before the latest message from a server, and acquires the message identifier of the latest message in the existing message in the live broadcast room, and can initiate the read request by using the message identifier of the latest message in the existing message in the live broadcast room when the read request is carried out next time, so that the read request is repeatedly executed. Therefore, according to the technical scheme, when the client enters the live broadcast room for the first time, the message set formed by the messages in the latest period of time (the latest second preset number is less than 1) in the live broadcast room at the moment and the message identifier of the latest message in the live broadcast room at the moment are obtained, and the next reading request is initiated according to the message identifier of the latest message in the live broadcast room at the moment when the next reading request is carried out, so that the updated message in the live broadcast room can be actively obtained from the server without repetition and loss.
Optionally, in an embodiment, the message identifier in the read request is different from any message identifier in the target index table, and the message set in step S33 is a message stored in the storage location corresponding to the last message identifier in the target index table and the storage location within a second preset number before the storage location. The method further comprises the following steps: and receiving the message identifier of the last message in the message set sent by the server, and updating the message identifier in the read request according to the message identifier so as to initiate the next read request according to the message identifier.
Through the technical scheme, when the message identifier in the sent reading request is wrong or the message identifier in the sent reading request is the message identifier of the earlier and former message in the live broadcast, the client can actively acquire the updated message in the live broadcast from the server without repetition and loss.
Optionally, the method further comprises: and receiving a request interval time sent by the server, wherein the request interval time is an interval time between the next time of sending the reading request and the current time of sending the reading request by the client.
Through the technical scheme, the interval time of the client sending the read request can be controlled by the server through the request interval time. Therefore, when the server senses that the pressure is too high, such as the CPU of the server is too high and the flow of the network card is too large, the request interval time sent to the plurality of clients is properly increased, so that the concurrence number of the requests of the clients is reduced to a certain extent. In addition, when the server perceives that the stress is small or constant, the request interval sent to the client may be reduced or unchanged as appropriate.
It should be noted that, as will be clear to those skilled in the art, for convenience and brevity of description, the steps in the information interaction method applied to the client may refer to the corresponding steps in the information interaction method applied to the server described above, and are not described herein again.
Based on the above inventive concept, another embodiment of the present disclosure further provides a message interaction apparatus for implementing the steps of the message interaction method applied to the server. The message interaction device may implement part or all of the server by software, hardware or a combination of both. As shown in fig. 4, the message interaction apparatus includes:
a read request receiving module 11, configured to receive a read request sent by a client, where the read request includes a message identifier and a live broadcast room identifier.
And a target index table obtaining module 13, configured to obtain a target index table according to the live broadcast room identifier, where the target index table is an index table corresponding to the live broadcast room identifier.
And a message set reading module 15, configured to read a message set according to the message identifier and the target index table.
A message set sending module 17, configured to send the message set to the client.
According to the technical scheme, the pull model is adopted when the client and the message interaction device perform message interaction, namely the client actively queries and acquires the message from the message interaction device by sending the read request comprising the message identifier and the live broadcast room identifier.
Optionally, in an embodiment, the message identifier in the read request is a message identifier of a last message in a message set that is read by the client from the server last time, and the message set reading module 15 is specifically configured to: and acquiring the storage position of the message corresponding to the message identifier according to the target index table, and reading the messages stored in the storage positions within a first preset number behind the storage position to obtain the message set. The message interaction device further comprises: and the message identification sending module. And the message identifier sending module is used for sending the read message identifier of the last message in the message set to the client so that the client can initiate a next reading request according to the message identifier.
Through the technical scheme, for the message in a live broadcast room, the client initiates a reading request according to the message identifier of the latest message in the message set read from the message interaction device last time, obtains the message set of the first preset number of messages (newer than the latest message) after the latest message from the message interaction device, and obtains the message identifier of the latest message in the message set, and initiates the reading request by using the message identifier of the latest message in the message set when the reading request is next time, so that the reading request is repeatedly executed, and the updated message in the live broadcast room can be actively obtained from the message interaction device without repetition and loss.
Optionally, in an embodiment, the message identifier in the read request is null, and the message set reading module 15 is specifically configured to: and acquiring a storage position of a message corresponding to the message identifier at the tail end in the target index table according to the target index table, and reading messages stored in the storage position and the previous storage positions within a second preset number to obtain the message set. The message interaction device further comprises: and the message identification sending module. And the message identifier sending module is used for sending the read message identifier of the last message in the message set to the client so that the client can initiate a next reading request according to the message identifier.
According to the technical scheme, for the message in a live broadcast room, when a client enters the live broadcast room for the first time, the client initiates a reading request with a message identifier being null, a message set formed by the latest message in the existing message in the live broadcast room and the message within a second preset number before the latest message is obtained from a message interaction device, the message identifier of the latest message in the existing message in the live broadcast room is obtained, and the reading request can be initiated by using the message identifier of the latest message in the existing message in the live broadcast room when the reading request is carried out next time, so that the reading request can be repeatedly executed. Therefore, according to the technical scheme, when the client enters the live broadcast room for the first time, the message set formed by the messages in the latest period of time (the latest second preset number is less than 1) in the live broadcast room at the moment and the message identifier of the latest message in the live broadcast room at the moment are obtained, and the next reading request is initiated according to the message identifier of the latest message in the live broadcast room at the moment when the next reading request is carried out, so that the updated message in the live broadcast room can be actively obtained from the message interaction device without repetition and loss.
Optionally, in an embodiment, the message identifier in the read request is different from any message identifier in the target index table, and the message set reading module 15 is specifically configured to: and acquiring a storage position of a message corresponding to the message identifier at the tail end in the target index table according to the target index table, and reading messages stored in the storage position and the previous storage positions within a second preset number to obtain the message set. The message interaction device further comprises: and the message identification sending module. And the message identifier sending module is used for sending the read message identifier of the last message in the message set to the client so that the client can initiate a next reading request according to the message identifier.
Through the technical scheme, when the message identifier in the sent read request is wrong or the message identifier in the sent read request is the message identifier of the earlier and former message in the live broadcast, the client can actively acquire the updated message in the live broadcast from the message interaction device without repetition and loss.
Optionally, the message interaction apparatus further includes a request interval sending module. The request interval sending module is used for sending request interval time to the client after receiving the read request sent by the client, wherein the request interval time is the interval time between the next time the client sends the read request and the current time the client sends the read request.
Through the technical scheme, the message interaction device can control the interval time of the client sending the read request through the request interval time. Therefore, when the message interaction device senses that the server pressure is too high, such as a server CPU is too high and the network card flow is too large, the request interval time sent to the plurality of clients is properly increased, so that the concurrence number of client requests is reduced to a certain extent. In addition, when perceived server stress is low or constant, the request interval sent to the client may be reduced or unchanged as appropriate.
Optionally, the message interaction apparatus further includes a request interval control module. The request interval control module is used for increasing the request interval time when the perceived pressure is larger than a preset value.
The sensing pressure of the message interaction device can be determined by means of server CPU, network card flow and the like, and correspondingly, the preset value is also determined by means of sensing the server pressure. For example, sensing whether the server pressure is greater than the preset value is performed by determining whether the server CPU is greater than the preset value, which may be set according to experience or by a user, and is not limited herein. When the pressure of the sensing server is too large, the request interval time sent to the client is properly increased, so that the concurrency number of client requests is reduced to a certain extent.
Optionally, the message interaction apparatus further includes:
and the write request receiving module is used for receiving a write request sent by a client, wherein the write request comprises a written message and a live broadcast room identifier.
The message storage module is used for writing the message into the pointed element of the pointer of the target circular linked list according to the live broadcast room identifier, the target circular linked list is a circular linked list corresponding to the live broadcast room identifier, the circular linked list is an array comprising a plurality of elements, each element is used for storing a message, the pointer of the circular linked list moves from the pointed initial element to the pointed tail element along with the writing of the message in sequence, and when the pointer moves next time after the tail element, the pointer points to the initial element again.
And the identification information generating module is used for generating the identification information of the message according to the time of receiving the write request.
And the target index table generation module is used for storing the identification information and the storage position of the message to the target index table, wherein the storage position points to a specific element of a target circular linked list for storing the message.
Through the technical scheme, the data structure of the circular linked list is defined, the message of each live broadcast room is stored in the circular linked list, the indexing is carried out through the corresponding index table, and the message reading performance is good.
Optionally, in an embodiment, the circular linked list is an array including 1000 elements. That is, for messages in a live broadcast room, only the latest 1000 messages can be stored, and messages older than the 1000 messages can be covered, so that the memory is saved.
It should be noted that, as is clear to those skilled in the art, for convenience and brevity of description, the specific working process and description of the apparatus described above may refer to the corresponding process in the foregoing method embodiments, and no further description is provided herein.
Based on the above inventive concept, another embodiment of the present disclosure further provides a message interaction apparatus for implementing the steps of the message interaction method applied to the client. The message interaction device can realize part or all of the client terminal through software, hardware or a combination of the software and the hardware. As shown in fig. 5, the message interaction apparatus includes:
a read request sending module 31, configured to send a read request to a server, where the read request includes a message identifier and a live broadcast room identifier.
And a message set receiving module 33, configured to receive and display a message set sent by the server, where the message set is read by the server according to the message identifier and a target index table, and the target index table is an index table corresponding to the live broadcast room identifier.
According to the technical scheme, the pull model is adopted when the message interaction device and the server perform message interaction, namely the message interaction device actively queries the server and acquires messages by sending the read request comprising the message identification and the live broadcast room identification, and under the condition of using the pull model, the condition that a large-scale user acquires the latest messages timely and without loss in a live broadcast scene at the same time can be met, and the live broadcast interaction experience is improved.
Optionally, in an embodiment, the message identifier in the read request is a message identifier of a last message in a message set read by the client from the server last time, and the message set in the message set receiving module 33 is a message stored in a storage location within a first preset number after a storage location of a message corresponding to the message identifier. The message interaction device also comprises a message identification receiving module. The message identifier receiving module is configured to receive a message identifier of a last message in the message set sent by the server, and update the message identifier in the read request according to the message identifier, so as to initiate a next read request according to the message identifier.
Through the technical scheme, for the messages in a live broadcast room, the message interaction device initiates a read request according to the message identifier of the latest message (the message at the tail end in the message set) in the message set read from the server last time, acquires the message set of the first preset number of messages (newer than the latest message) after the latest message from the server, and acquires the message identifier of the latest message in the message set, and initiates the read request by using the message identifier of the latest message in the message set when the message is read for the next time, so that the read request is repeatedly executed, and the updated messages in the live broadcast room can be actively acquired from the server without repetition and loss.
Optionally, in an embodiment, the message identifier in the read request is null, and the message set in the message set receiving module 33 is a message stored in the storage location corresponding to the last message identifier in the target index table and a storage location within a second preset number before the storage location. The message interaction device also comprises a message identification receiving module. The message identifier receiving module is configured to receive a message identifier of a last message in the message set sent by the server, and update the message identifier in the read request according to the message identifier, so as to initiate a next read request according to the message identifier.
According to the technical scheme, when a client enters a live broadcast room for the first time, the message interaction device initiates a read request with a message identifier being empty, acquires a message set formed by a latest message (a message corresponding to the latest message identifier in the target index table) in existing messages of the live broadcast room and messages within a second preset number before the latest message from the server, acquires the message identifier of the latest message in the existing messages of the live broadcast room, and initiates the read request by using the message identifier of the latest message in the existing messages of the live broadcast room when the next read request is carried out repeatedly. Therefore, according to the technical scheme, when the client enters the live broadcast room for the first time, the message set formed by the messages in the latest period of time (the latest second preset number is less than 1) in the live broadcast room at the moment and the message identifier of the latest message in the live broadcast room at the moment are obtained, and the next reading request is initiated according to the message identifier of the latest message in the live broadcast room at the moment when the next reading request is carried out, so that the updated message in the live broadcast room can be actively obtained from the server without repetition and loss.
Optionally, in an embodiment, the message identifier in the read request is different from any message identifier in the target index table, and the message set in the message set receiving module 33 is a message stored in the storage location of the message corresponding to the last message identifier in the target index table and the storage location within the second preset number before the storage location. The message interaction device also comprises a message identification receiving module. The message identifier receiving module is configured to receive a message identifier of a last message in the message set sent by the server, and update the message identifier in the read request according to the message identifier, so as to initiate a next read request according to the message identifier.
Through the technical scheme, when the message identifier in the sent reading request is wrong or the message identifier in the sent reading request is the message identifier of the earlier and former message in the live broadcast, the client can actively acquire the updated message in the live broadcast from the server without repetition and loss.
Optionally, the message interaction apparatus further includes a request interval receiving module. The request interval receiving module is configured to receive a request interval sent by the server, where the request interval is an interval between the next time the client sends the read request and the current time the read request is sent.
Through the technical scheme, the interval time of the client sending the read request can be controlled by the server through the request interval time. Therefore, when the server senses that the pressure is too high, such as the CPU of the server is too high and the flow of the network card is too large, the request interval time sent to the plurality of clients is properly increased, so that the concurrence number of the requests of the clients is reduced to a certain extent. In addition, when the server perceives that the stress is small or constant, the request interval sent to the client may be reduced or unchanged as appropriate.
It should be noted that, as is clear to those skilled in the art, for convenience and brevity of description, the specific working process and description of the apparatus described above may refer to the corresponding process in the foregoing method embodiments, and no further description is provided herein.
The embodiments of the present disclosure also provide a computer readable medium, on which a computer program is stored, which when executed by a processing device, can perform the above-mentioned message interaction method applied to a server or perform the above-mentioned steps of the message interaction method applied to a client.
Referring now to fig. 6, a schematic diagram of an electronic device 600 suitable for implementing embodiments of the present disclosure is shown, which may be applied to a server or a client. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 6, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText transfer protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving a reading request sent by a client, wherein the reading request comprises a message identifier and a live broadcast room identifier; acquiring a target index table according to the live broadcast room identification, wherein the target index table is an index table corresponding to the live broadcast room identification; reading a message set according to the message identifier and the target index table; and sending the message set to the client.
Alternatively, the computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: sending a reading request to a server, wherein the reading request comprises a message identifier and a live broadcast room identifier; and receiving and displaying a message set sent by the server, wherein the message set is read by the server according to the message identifier and a target index table, and the target index table is an index table corresponding to the live broadcast room identifier.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented by software or hardware. The name of the module does not in some cases constitute a limitation of the module itself, and for example, the read request receiving module may also be described as a "module that receives a read request sent by a client".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, an example provides a message interaction method applied to a server, where the server stores a plurality of index tables, and each index table reflects a correspondence between message identifiers of all messages in a live broadcast and storage locations of all messages in the live broadcast, where the method includes: receiving a reading request sent by a client, wherein the reading request comprises a message identifier and a live broadcast room identifier; acquiring a target index table according to the live broadcast room identification, wherein the target index table is an index table corresponding to the live broadcast room identification; reading a message set according to the message identifier and the target index table; and sending the message set to the client.
According to one or more embodiments of the present disclosure, example two provides the method of example one, where the message identifier in the read request is a message identifier of a last message in a message set that is read by the client from the server last time, and the step of reading a message set according to the message identifier and the target index table includes: acquiring a storage position of a message corresponding to the message identifier according to the target index table, and reading messages stored in the storage positions within a first preset number behind the storage position to obtain a message set; the method further comprises the following steps: and sending the read message identifier of the last message in the message set to the client so that the client can initiate the next reading request according to the message identifier.
According to one or more embodiments of the present disclosure, example three provides the method of example one, where in a case that a message identifier in the read request is null or the message identifier in the read request is different from any message identifier in the target index table, the step of reading a message set according to the message identifier and the target index table includes: acquiring a storage position of a message corresponding to the last message identifier in the target index table according to the target index table, and reading messages stored in the storage position and a storage position within a second preset number before the storage position to obtain a message set; the method further comprises the following steps: and sending the read message identifier of the last message in the message set to the client so that the client can initiate the next reading request according to the message identifier.
Example four provides the method of any one of examples one to three, further comprising, in accordance with one or more embodiments of the present disclosure: and after receiving the read request sent by the client, sending request interval time to the client, wherein the request interval time is the interval time between the next time of sending the read request and the current time of sending the read request by the client.
In accordance with one or more embodiments of the present disclosure, example five provides the method of example four, prior to the step of sending a request interval time to the client, the method further comprising: and when the perceived pressure is larger than the preset value, increasing the request interval time.
Example six provides the method of any one of examples one to three, further comprising, in accordance with one or more embodiments of the present disclosure: receiving a write request sent by a client, wherein the write request comprises a written message and a live broadcast room identifier; writing the message into an element pointed by a pointer of a target circular linked list according to the live broadcast room identifier, wherein the target circular linked list is a circular linked list corresponding to the live broadcast room identifier, the circular linked list is an array comprising a plurality of elements, each element is used for storing one message, the pointer of the circular linked list sequentially moves from a pointed initial element to a pointed tail element along with the writing of the message, and moves next time to point the initial element after pointing the tail element; generating identification information of the message according to the time of receiving the write request; and storing the identification information and the storage position of the message to the target index table, wherein the storage position points to a specific element of a target circular linked list for storing the message.
According to one or more embodiments of the present disclosure, example seven provides a message interaction method applied to a client, the method including: sending a reading request to a server, wherein the reading request comprises a message identifier and a live broadcast room identifier; and receiving and displaying a message set sent by the server, wherein the message set is read by the server according to the message identifier and a target index table, and the target index table is an index table corresponding to the live broadcast room identifier.
Example eight provides, according to one or more embodiments of the present disclosure, a message interaction apparatus applied to a server, where the server stores a plurality of index tables, and each index table reflects a correspondence between message identifiers of all messages in a live broadcast and storage locations of all messages in the live broadcast, including: the reading request receiving module is used for receiving a reading request sent by a client, and the reading request comprises a message identifier and a live broadcast room identifier; a target index table obtaining module, configured to obtain a target index table according to the live broadcast room identifier, where the target index table is an index table corresponding to the live broadcast room identifier; the message set reading module is used for reading a message set according to the message identifier and the target index table; and the message set sending module is used for sending the message set to the client.
According to one or more embodiments of the present disclosure, example nine provides a message interaction apparatus, applied to a client, including: the reading request sending module is used for sending a reading request to the server, wherein the reading request comprises a message identifier and a live broadcast room identifier; and the message set receiving module is used for receiving and displaying a message set sent by the server, wherein the message set is read by the server according to the message identifier and a target index table, and the target index table is an index table corresponding to the live broadcast room identifier.
Example ten provides a computer readable medium having stored thereon a computer program that, when executed by a processing device, implements the steps of the method of any one of examples one to seven in accordance with one or more embodiments of the present disclosure.
According to one or more embodiments of the present disclosure, example eleven provides an electronic device applied to a server, including: a storage device having a computer program stored thereon; processing means for executing the computer program in the storage means to implement the steps of the method of any one of examples one to six.
In accordance with one or more embodiments of the present disclosure, example twelve provides an electronic device applied to a client, comprising: a storage device having a computer program stored thereon; processing means for executing said computer program in said storage means to carry out the steps of the method of example seven.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims. With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims (12)

1. A message interaction method is applied to a server, the server stores a plurality of index tables, each index table reflects the corresponding relation between message identifications of all messages in a live broadcast room and storage positions of all messages in the live broadcast room, and the method comprises the following steps:
receiving a reading request sent by a client, wherein the reading request comprises a message identifier and a live broadcast room identifier;
acquiring a target index table according to the live broadcast room identification, wherein the target index table is an index table corresponding to the live broadcast room identification;
reading a message set according to the message identifier and the target index table;
and sending the message set to the client.
2. The method according to claim 1, wherein the message identifier in the read request is a message identifier of a last message in a message set read by the client from the server last time, and the step of reading a message set according to the message identifier and the target index table comprises:
acquiring a storage position of a message corresponding to the message identifier according to the target index table, and reading messages stored in the storage positions within a first preset number behind the storage position to obtain a message set;
the method further comprises the following steps: and sending the read message identifier of the last message in the message set to the client so that the client can initiate the next reading request according to the message identifier.
3. The method according to claim 1, wherein in a case that the message identifier in the read request is empty or the message identifier in the read request is different from any message identifier in the target index table, the step of reading a message set according to the message identifier and the target index table comprises:
acquiring a storage position of a message corresponding to the last message identifier in the target index table according to the target index table, and reading messages stored in the storage position and a storage position within a second preset number before the storage position to obtain a message set;
the method further comprises the following steps: and sending the read message identifier of the last message in the message set to the client so that the client can initiate the next reading request according to the message identifier.
4. The method according to any one of claims 1-3, further comprising:
and after receiving the read request sent by the client, sending request interval time to the client, wherein the request interval time is the interval time between the next time of sending the read request and the current time of sending the read request by the client.
5. The method of claim 4, wherein prior to the step of sending a request interval time to the client, the method further comprises:
and when the perceived pressure is larger than the preset value, increasing the request interval time.
6. The method according to any one of claims 1-3, further comprising:
receiving a write request sent by a client, wherein the write request comprises a written message and a live broadcast room identifier;
writing the message into an element pointed by a pointer of a target circular linked list according to the live broadcast room identifier, wherein the target circular linked list is a circular linked list corresponding to the live broadcast room identifier, the circular linked list is an array comprising a plurality of elements, each element is used for storing one message, the pointer of the circular linked list sequentially moves from a pointed initial element to a pointed tail element along with the writing of the message, and moves next time to point the initial element after pointing the tail element;
generating identification information of the message according to the time of receiving the write request;
and storing the identification information and the storage position of the message to the target index table, wherein the storage position points to a specific element of a target circular linked list for storing the message.
7. A message interaction method is applied to a client, and comprises the following steps:
sending a reading request to a server, wherein the reading request comprises a message identifier and a live broadcast room identifier;
and receiving and displaying a message set sent by the server, wherein the message set is read by the server according to the message identifier and a target index table, and the target index table is an index table corresponding to the live broadcast room identifier.
8. A message interaction device is applied to a server, the server stores a plurality of index tables, each index table reflects the corresponding relation between message identifications of all messages in a live broadcast room and storage positions of all messages in the live broadcast room, and the message interaction device comprises:
the reading request receiving module is used for receiving a reading request sent by a client, and the reading request comprises a message identifier and a live broadcast room identifier;
a target index table obtaining module, configured to obtain a target index table according to the live broadcast room identifier, where the target index table is an index table corresponding to the live broadcast room identifier;
the message set reading module is used for reading a message set according to the message identifier and the target index table;
and the message set sending module is used for sending the message set to the client.
9. A message interaction device applied to a client side comprises:
the reading request sending module is used for sending a reading request to the server, wherein the reading request comprises a message identifier and a live broadcast room identifier;
and the message set receiving module is used for receiving and displaying a message set sent by the server, wherein the message set is read by the server according to the message identifier and a target index table, and the target index table is an index table corresponding to the live broadcast room identifier.
10. A computer-readable medium, on which a computer program is stored, characterized in that the program, when being executed by processing means, carries out the steps of the method of any one of claims 1 to 7.
11. An electronic device, applied to a server, comprising:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to carry out the steps of the method according to any one of claims 1 to 6.
12. An electronic device, applied to a client, includes:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to carry out the steps of the method as claimed in claim 7.
CN201911046890.9A 2019-10-30 2019-10-30 Message interaction method and device, readable medium and electronic equipment Pending CN110708237A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201911046890.9A CN110708237A (en) 2019-10-30 2019-10-30 Message interaction method and device, readable medium and electronic equipment
PCT/CN2020/106907 WO2021082584A1 (en) 2019-10-30 2020-08-04 Message exchange method and apparatus, readable medium, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911046890.9A CN110708237A (en) 2019-10-30 2019-10-30 Message interaction method and device, readable medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN110708237A true CN110708237A (en) 2020-01-17

Family

ID=69202918

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911046890.9A Pending CN110708237A (en) 2019-10-30 2019-10-30 Message interaction method and device, readable medium and electronic equipment

Country Status (2)

Country Link
CN (1) CN110708237A (en)
WO (1) WO2021082584A1 (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111277847A (en) * 2020-01-21 2020-06-12 香港乐蜜有限公司 Method, device, server and system for displaying chat messages in live broadcast
CN111405323A (en) * 2020-03-12 2020-07-10 北京字节跳动网络技术有限公司 Sampling method and device for pulling message record, electronic equipment and medium
CN111444018A (en) * 2020-03-30 2020-07-24 北京字节跳动网络技术有限公司 Request processing method and device
CN111464820A (en) * 2020-03-31 2020-07-28 北京字节跳动网络技术有限公司 Sampling method and device for pulling message record, electronic equipment and storage medium
CN112040328A (en) * 2020-08-04 2020-12-04 北京字节跳动网络技术有限公司 Data interaction method and device and electronic equipment
WO2021082584A1 (en) * 2019-10-30 2021-05-06 北京字节跳动网络技术有限公司 Message exchange method and apparatus, readable medium, and electronic device
CN113037608A (en) * 2021-02-23 2021-06-25 北京百度网讯科技有限公司 Message reply method and device, electronic equipment and readable storage medium
CN114124863A (en) * 2021-09-14 2022-03-01 微梦创科网络科技(中国)有限公司 Message continuity identification method, device and system
CN114189565A (en) * 2020-08-31 2022-03-15 华为技术有限公司 Header field restoration system, method and related equipment
CN114554129A (en) * 2020-11-25 2022-05-27 北京字节跳动网络技术有限公司 Wheat connecting system, method, device, equipment and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113259704B (en) * 2021-05-19 2023-06-09 杭州米络星科技(集团)有限公司 Live broadcast room initialization method, device, equipment and storage medium
CN115065721A (en) * 2022-04-21 2022-09-16 北京达佳互联信息技术有限公司 Message processing method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160014477A1 (en) * 2014-02-11 2016-01-14 Benjamin J. Siders Systems and Methods for Synchronized Playback of Social Networking Content
CN105933213A (en) * 2016-06-24 2016-09-07 腾讯科技(深圳)有限公司 Processing method, related equipment and system of chat message
CN106604043A (en) * 2016-12-30 2017-04-26 Ut斯达康(深圳)技术有限公司 Internet-based live broadcast method and live broadcast server
CN109006678A (en) * 2018-08-10 2018-12-18 肇庆市高新区甜慕新能源技术有限公司 A kind of system of wireless monitor hatching of breeding eggs
CN109067910A (en) * 2018-09-13 2018-12-21 乐蜜有限公司 A kind of method and device that message pulls
CN109275042A (en) * 2018-10-17 2019-01-25 武汉斗鱼网络科技有限公司 A kind of distribution method, device, terminal and the storage medium of barrage message

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10469417B2 (en) * 2016-03-31 2019-11-05 Atlassian Pty Ltd Systems and methods for providing external content in a messaging interface
CN109600678B (en) * 2018-12-19 2021-11-02 北京达佳互联信息技术有限公司 Information display method, device and system, server, terminal and storage medium
CN110708237A (en) * 2019-10-30 2020-01-17 北京字节跳动网络技术有限公司 Message interaction method and device, readable medium and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160014477A1 (en) * 2014-02-11 2016-01-14 Benjamin J. Siders Systems and Methods for Synchronized Playback of Social Networking Content
CN105933213A (en) * 2016-06-24 2016-09-07 腾讯科技(深圳)有限公司 Processing method, related equipment and system of chat message
CN106604043A (en) * 2016-12-30 2017-04-26 Ut斯达康(深圳)技术有限公司 Internet-based live broadcast method and live broadcast server
CN109006678A (en) * 2018-08-10 2018-12-18 肇庆市高新区甜慕新能源技术有限公司 A kind of system of wireless monitor hatching of breeding eggs
CN109067910A (en) * 2018-09-13 2018-12-21 乐蜜有限公司 A kind of method and device that message pulls
CN109275042A (en) * 2018-10-17 2019-01-25 武汉斗鱼网络科技有限公司 A kind of distribution method, device, terminal and the storage medium of barrage message

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021082584A1 (en) * 2019-10-30 2021-05-06 北京字节跳动网络技术有限公司 Message exchange method and apparatus, readable medium, and electronic device
CN111277847A (en) * 2020-01-21 2020-06-12 香港乐蜜有限公司 Method, device, server and system for displaying chat messages in live broadcast
CN111277847B (en) * 2020-01-21 2022-02-25 卓米私人有限公司 Method, device, server and system for displaying chat messages in live broadcast
CN111405323A (en) * 2020-03-12 2020-07-10 北京字节跳动网络技术有限公司 Sampling method and device for pulling message record, electronic equipment and medium
CN111405323B (en) * 2020-03-12 2021-03-05 北京字节跳动网络技术有限公司 Sampling method and device for pulling message record, electronic equipment and medium
CN111444018A (en) * 2020-03-30 2020-07-24 北京字节跳动网络技术有限公司 Request processing method and device
CN111444018B (en) * 2020-03-30 2023-08-08 北京字节跳动网络技术有限公司 Request processing method and device
CN111464820B (en) * 2020-03-31 2022-05-10 北京字节跳动网络技术有限公司 Sampling method and device for pulling message record, electronic equipment and storage medium
CN111464820A (en) * 2020-03-31 2020-07-28 北京字节跳动网络技术有限公司 Sampling method and device for pulling message record, electronic equipment and storage medium
CN112040328A (en) * 2020-08-04 2020-12-04 北京字节跳动网络技术有限公司 Data interaction method and device and electronic equipment
CN114189565A (en) * 2020-08-31 2022-03-15 华为技术有限公司 Header field restoration system, method and related equipment
CN114189565B (en) * 2020-08-31 2023-10-20 华为技术有限公司 Head area restoration system, method and related equipment
CN114554129A (en) * 2020-11-25 2022-05-27 北京字节跳动网络技术有限公司 Wheat connecting system, method, device, equipment and storage medium
CN114554129B (en) * 2020-11-25 2023-10-31 北京字节跳动网络技术有限公司 Wheat connecting system, method, device, equipment and storage medium
CN113037608A (en) * 2021-02-23 2021-06-25 北京百度网讯科技有限公司 Message reply method and device, electronic equipment and readable storage medium
CN114124863A (en) * 2021-09-14 2022-03-01 微梦创科网络科技(中国)有限公司 Message continuity identification method, device and system
CN114124863B (en) * 2021-09-14 2023-11-14 微梦创科网络科技(中国)有限公司 Message continuity identification method, device and system

Also Published As

Publication number Publication date
WO2021082584A1 (en) 2021-05-06

Similar Documents

Publication Publication Date Title
CN110708237A (en) Message interaction method and device, readable medium and electronic equipment
CN110909521B (en) Online document information synchronous processing method and device and electronic equipment
CN110781373B (en) List updating method and device, readable medium and electronic equipment
CN113395353B (en) File downloading method and device, storage medium and electronic equipment
US11936924B2 (en) Live room setup method and apparatus, electronic device, and storage medium
CN111309747A (en) Data synchronization method, system and device
CN110795446A (en) List updating method and device, readable medium and electronic equipment
CN112015816A (en) Data synchronization method, device, medium and electronic equipment
CN112256733A (en) Data caching method and device, electronic equipment and computer readable storage medium
CN111163336B (en) Video resource pushing method and device, electronic equipment and computer readable medium
CN111262907B (en) Service instance access method and device and electronic equipment
CN111597403A (en) Method and device for constructing graph index, electronic equipment and storage medium
CN112418389A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN113420400B (en) Routing relation establishment method, request processing method, device and equipment
CN111309366B (en) Method, device, medium and electronic equipment for managing registration core
CN114785770A (en) Mirror layer file sending method and device, electronic equipment and computer readable medium
CN112507676B (en) Method and device for generating energy report, electronic equipment and computer readable medium
CN115328506A (en) Application package generation method, loading method, device, medium and equipment
CN115082038A (en) System integration method and device and electronic equipment
CN113742426A (en) Data synchronization method, device, equipment, server and storage medium
CN111628913A (en) Online time length determining method and device, readable medium and electronic equipment
CN112311840A (en) Multi-terminal data synchronization method, device, equipment and medium
CN111212296A (en) Live broadcast room gift list configuration method, device, medium and electronic equipment
CN111787107B (en) Message processing method and device, readable medium and electronic equipment
CN111314457B (en) Method and device for setting virtual private cloud

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200117