Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating an application scenario of a message processing method provided in an embodiment of the present application, where the application scenario includes a live broadcast interactive system 10 provided in an embodiment of the present application. The live interaction system 10 includes: a terminal device 100 and a server 200. Wherein, the terminal device 100 and the server 200 are located in a wireless network or a wired network, and the terminal device 100 and the server 200 can perform data interaction. In some embodiments, there may be a plurality of terminal devices 100, the server 200 may be communicatively connected to a plurality of terminal devices 100, a plurality of terminal devices 100 may also be communicatively connected to each other through the internet, and the server 200 may also be used as a transmission medium to implement data interaction with each other through the internet.
In this embodiment, the terminal device 100 may be a mobile phone, a smart phone, a notebook computer, a desktop computer, a tablet computer, a Personal Digital Assistant (PDA), a media player, a smart television, a wearable electronic device, and the like, and a specific type of the terminal device may not be limited in this embodiment. The server 200 may be a single server, or a server cluster, or a local server, or a cloud server, and a specific server type may not be limited in this embodiment of the application.
In some embodiments, a client may be installed in the terminal device 100. The client may be a computer Application (APP) installed on the terminal device 100, or may be a Web client, which may refer to an Application developed based on a Web architecture. When a user logs in through an account at a client, all information corresponding to the account can be stored in the storage space of the server 200. The information corresponding to the account includes information input by the user through the client, information received by the user through the client, and the like.
In some implementations, the client can be an application of a live platform, and live content can be displayed on a live interface of the client. The client can be divided into: a client used by the anchor and a client used by the viewer. The live content may be a video uploaded by a main broadcast server, that is, a content presented by the main broadcast, the main broadcast may transmit an uploaded video stream to the server 200 through a used client, and then the server 200 forwards the video stream to clients used by all viewers in the same channel (or live room) as the main broadcast, so that the live content corresponding to the video stream may be displayed on a live interface of the client used by the viewers. The video stream uploaded by the anchor program may be a video stream obtained by recording a screen through a terminal device, such as a game picture of the anchor program, or a video stream acquired based on a camera, which is not limited herein.
Further, the client may also receive a trigger event (e.g., a click event, a touch event, etc.) input by the user based on the client, where the trigger event may act on a manipulation object displayed on the live interface. And the client receives the trigger event and can execute the operation corresponding to the control object acted by the trigger event. The control object may be the whole picture displayed on the live interface or display content in the picture. As one way, the manipulation object may be a virtual gift displayed in the screen, and the client used by the viewer may trigger execution of a corresponding operation when receiving a trigger event acting on the virtual gift. In the embodiment of the application, in response to the interactive operation of the user, the client can display the interactive content corresponding to the interactive operation on the live broadcast interface so as to enhance the live broadcast interactive atmosphere. The interactive operation is an operation triggered by the user and related to the interaction between the users, and includes but is not limited to a gift sending operation of the audience giving a virtual gift to the main broadcasting/audience.
For example, the client may generate interactive data to be sent to the server 200 in response to a gift sending operation of a user for presenting a virtual gift, the server 200 packages the interactive data into a broadcast message and forwards the broadcast message to a client used by a main broadcast of the same channel (or a live broadcast room) and clients used by other viewers, and the client may display interactive content corresponding to the broadcast message on a live broadcast interface by processing the broadcast message. Therefore, when watching the live broadcast content in the live broadcast room, the user can give the virtual gift to the main broadcast of the live broadcast room and can watch the interactive content to know the interactive events of the live broadcast room, such as the information of the virtual gift given by the user or other users, so that the interaction between the audience and the main broadcast, the interaction between the audience and the live broadcast are realized, and the live broadcast interactive atmosphere is enhanced.
However, in the live broadcasting process, a user may perform gift sending operation for multiple times in a short time to generate a large amount of broadcast messages, the broadcast messages have the characteristics of concentration, disorder, high execution consumption and the like, and if each message is processed and executed one by one, the processing burden of a system is too heavy, and the resource consumption is too large. Therefore, to solve the above-mentioned drawbacks, embodiments of the present application provide a message processing method, device, system, electronic device, and storage medium. The following will be described in detail by way of specific examples.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating a message processing method according to an embodiment of the present application, and the message processing method is applicable to the client. The flow shown in fig. 2 will be described in detail below. The message processing method may include the steps of:
step S110: at least one gift giving message is obtained.
The gift sending message is triggered by gift sending operation input by at least one user in a live interface of at least one live client, and the gift sending message is used for determining interactive content displayed in the live interface. The live broadcast client is used for displaying a client of a live broadcast interface. The user can trigger the instruction corresponding to the gift sending operation through the gift sending operation acting on the client, and the client can obtain the gift sending message corresponding to the instruction after receiving the instruction.
The gift giving operation can be input through input modes such as touch, pressing and voice, and the trigger mode of the gift giving operation is not limited in any way in the embodiment of the application. For example, a plurality of virtual gifts may be displayed on the live broadcast interface, the user may touch an icon corresponding to one virtual gift, so as to trigger a gift sending operation corresponding to the virtual gift, so as to give the virtual gift to the main broadcast, and the client may obtain an instruction corresponding to the gift sending operation. In some embodiments, the instructions may include at least one of a gift ID of the virtual gift, a user ID of the gift sender, a user ID of the gift receiver, a live room ID where the gift is sent, and the like. For example, when the audience 1 triggers a gift sending operation based on the client, specifically, the gift sending behavior corresponding to the gift sending operation is that the audience 1 presents a virtual gift corresponding to the "lollipop" style to the anchor a, the client may obtain an instruction including a gift ID of the "lollipop", a user ID of the audience 1, and a user ID of the anchor a, and send the instruction to the server.
In one implementation, after each client obtains the instruction corresponding to the gift sending operation, the instruction can be sent to the server, and after the server receives the instruction, the server can search the configuration information corresponding to the instruction, generate a gift sending message corresponding to the gift sending operation according to the configuration information, and send the gift sending message to a user in a live broadcast room, so that the user in the live broadcast room can receive the gift sending message based on the client. One gift sending operation can correspond to a plurality of gift sending messages, different gift sending messages can correspond to different message configurations, and the message configurations can include information such as message IDs. In one example, a user triggers a gift sending operation to send a gift to a host based on a live interface, the server may generate a plurality of gift sending messages corresponding to the gift sending operation, each gift sending message corresponds to a different message configuration, and the message configuration may be determined by a service type of the message.
In the embodiment of the application, the gift-sending message can be determined by the service type of the gift-sending message, one gift-sending message corresponds to one service type, the service type corresponds to the interactive content displayed on the live interface, and the gift-sending message is used for determining that the interactive content corresponding to the service type is displayed on the live interface. One gift sending operation can correspond to at least one gift sending message, the gift sending message corresponds to a message ID, one service type corresponds to a message ID, and different gift sending operations can correspond to gift sending messages of the same service type.
Since different gift-giving operations may correspond to the same service, such as updating the total value of the gift, displaying gift-giving information, and the like, the service types of the gift-giving messages corresponding to the different gift-giving operations may be the same, that is, the different gift-giving operations may correspond to gift-giving messages of the same message ID. In this embodiment of the present application, the same gift-offering message may be the same message configuration, and whether other information is the same or not, which is not limited herein.
In one example, in response to a gift sending operation triggered by a user, the client may need to process at least one service, and the client may process the corresponding service by processing messages of at least one service type. Therefore, after the server receives an instruction corresponding to the gift sending operation, the server can determine the service required to be processed in response to the gift sending operation, the server searches the configuration information corresponding to the service according to the service type corresponding to the service, so that the corresponding gift sending message is generated according to the configuration information, the gift sending message is sent to the client, the client obtains the gift sending message, the service corresponding to the gift sending operation is processed through processing the gift sending message, and the interactive content displayed on the live broadcast interface is updated to respond to the gift sending operation.
For example, the total value of the gifts obtained by the anchor a is 3000 as shown in the live interface of the live broadcast room H, at this time, if the user 1 gives 1314 virtual gifts in the "lollipops" style to the anchor a, the server determines that the services to be processed may include displaying gift giving information that the user 1 gives 1314 lollipops to the anchor a, updating the total value of the gifts currently obtained by the anchor a to be "4314" and the like according to the gift giving operation, and each service corresponds to one gift message, that is, one gift message is used for displaying the gift giving information and one message is used for updating the total value of the gifts. The server sends two gift sending messages to the clients of the users of the live broadcast room H, including the client used by the anchor and the client used by the audience.
In practical application, a user may trigger a gift sending operation for multiple times in a short time, so that the server can distribute gift sending messages corresponding to the gift sending operations to the client, and the client can obtain multiple gift sending messages. In this embodiment of the application, the gift-offering operation triggered by multiple times may be triggered by one user, or triggered by at least two users, which is not limited herein.
In some embodiments, to increase user retention of the live room, a spelling (PK) interaction may be performed between the anchor and the anchor. The PK interactions may relate to various interactive scenes of the spelling competition, such as playing games PK, singing, dancing, magic, speaking, and so on. When at least two anchor roles perform PK interaction, the client can display a live interface including the PK interaction of the at least two anchor roles. The client displaying the live broadcast interface with PK interaction may be a client used by the audience, or a client used by the anchor.
In some embodiments, when performing PK interactions, the anchor and the anchor may connect to each other, so that the viewer may simultaneously see live content of clients corresponding to multiple PK anchors (i.e., anchors participating in a spelling interaction), for example, a singing performance of the anchor, a chat between the anchor and the anchor, and the like, through the used client. Further, the main broadcasting and the main broadcasting can be connected with each other to form a video, so that a client used by a viewer can simultaneously display the live content of the client corresponding to a plurality of PK main broadcasting. In some embodiments, the live content displayed by the client used by the anchor may also be synchronized with the live content displayed by the client of the viewer, that is, the live content of the client corresponding to a plurality of PK anchors may also be simultaneously displayed by the client of each anchor in the PK interactions.
In some embodiments, when a live video is conducted between PK anchor in PK interactions, the client displays a live interface that may include live content of multiple PK anchors. As one embodiment, the live content of each PK anchor may be laid out separately in the live interface. For example, when two anchor players perform PK interaction, the left half of the live interface displays live content of my anchor player (i.e., the anchor player corresponding to the live broadcast room where the client is currently located), and the right half displays live content of an enemy anchor player (i.e., other PK anchor players in PK interaction except my anchor player). In other embodiments, in order to avoid interfering with the live content of other anchor, the anchor and anchor in the PK interaction may not be connected to each other, and not be video, and is not limited herein.
In some embodiments, the PK interaction is an interaction mode, and when the PK interaction is started, a user in a live broadcast room can send a gift to a main broadcast through a client so as to improve the PK value of the main broadcast. If one wants to win in a PK interaction, the anchor needs to have a higher PK value. Therefore, after the PK interaction is started, in order to allow the supported anchor to win, the user can trigger the gift sending operation for multiple times in a short time so as to give gifts to the supported anchor, the PK value of the anchor is improved, the server can generate a large amount of gift sending messages according to the large amount of gift sending operation at the moment, and the client side can obtain the large amount of gift sending messages in a short time.
Step S120: and determining the message to be processed from at least one gift sending message according to the service type of each gift sending message.
In practical application, when a client acquires a large number of gift sending messages, if the gift sending messages are processed one by one, the processing load of the system is large, so that the processing capacity of the client is high, and if the client runs on a terminal device with low processing capacity, messages sent at almost the same time are processed one by one, a large amount of delay may exist, and the live broadcast experience of a user is influenced.
Because the processing requirements of a large number of gift sending messages are different, although a large number of gift sending messages exist at the same time, the real-time requirements of the gift sending messages of different service types may be different, namely, part of the service types have higher requirements on the real-time performance, and part of the service types have lower requirements on the real-time performance. Therefore, the client determines the message to be processed from at least one gift sending message according to the service type of each gift sending message, the number of messages to be processed at the same time can be reduced, all the obtained gift sending messages are not processed, the processing load of a system can be effectively reduced, the processing pressure of the client is reduced, and the resource consumption is reduced.
Since different service types have different requirements on real-time performance in processing, in some embodiments, a higher priority may be set for a service type with a high real-time performance requirement, so that gift-sending messages of a service type with a high real-time performance requirement may be processed in time. In other embodiments, a higher weight may be further set for the service type with high real-time requirement, so that the finally determined gift sending message with high real-time requirement occupies a higher proportion of the messages to be processed. Therefore, the client determines the service type with high real-time requirement in the message to be processed according to the service type, and can occupy a larger proportion, so that more gift sending messages with high real-time requirement can be processed in a period of time, namely, the corresponding interactive content on the live broadcast interface can be updated or displayed more frequently or in time, the interactive content with high real-time requirement can be updated or displayed in time by screening the gift sending messages according to the service type, and the interactive content with low real-time requirement is updated or displayed in a delayed manner. Therefore, the quantity of the messages which are processed concurrently can be greatly reduced, the messages with lower real-time requirements can be delayed according to actual requirements according to the service types, and the messages with higher real-time requirements are processed preferentially and timely.
In some embodiments, the message configuration of each gift sending message includes a real-time level, where the real-time level is a field in the message configuration for identifying the real-time level of the gift sending message, and the field may include a plurality of values, for example, any of 0 to 9, so as to respectively correspond to the real-time levels of different service types, and after obtaining the gift sending message, the message to be processed may be determined according to the real-time level of the gift sending message.
As one mode, the weights may be sequentially set according to the real-time level of the service type, for example, a mapping relationship corresponding to the real-time level and the weights may be preset, and similarly, a mapping relationship corresponding to the service type and the weights may also be set. The mapping relationship may be in various forms such as a mapping table and a mapping function, and is not limited herein. In addition, the mapping relationship may be stored in a terminal device, a server, or a client may download updates from a network, and the like. In one example, levels of real-time 0-3 may be one-to-one associated with weights 1-4, such that traffic types with higher levels of real-time have higher weights, such that gift-giving messages with higher levels of real-time account for a greater proportion of the gift-giving messages included in the determination of pending messages.
In a live application, one gift-offering operation may correspond to gift-offering messages of multiple service types, with different service types corresponding to different interactive contents in the live interface. In one embodiment, multiple service types may be distinguished according to whether further interaction is required for their corresponding interactive content, for example, part of the service types involve interaction, such as triggering an interactive treasure box and triggering an interactive banner (requiring user interaction), and part of the service types do not interact and are only displayed, such as presenting a special effect of gift information (only for displaying the special effect), and the like. Because, in a live application where importance is placed on the interaction between users, the real-time requirements for handling the types of traffic involved in the interaction are higher than those of traffic without interaction. For example, the real-time requirement of the "trigger interactive treasure box" is higher than the "special effect of gift information display", according to the service type of the gift-sending message, the client determines the 5 pieces of gift-sending messages of the "trigger interactive treasure box" and the 1 piece of gift-sending messages of the "special effect of gift information display" as the messages to be processed, so that when the client executes the messages to be processed, when the 7 pieces of gift-sending messages of the "trigger interactive treasure box" are acquired, the 5 times of gift-sending messages and the 1 time of "special effect of gift information display" are executed and displayed, and when the 10 pieces of gift-sending messages of the "special effect of gift information display" are acquired, the timely processing of the gift-sending messages of the "trigger interactive treasure box" and the delayed processing of the gift-sending messages of the "special effect of gift information display" are realized, that is the timely processing of the gift-sending messages of the service type with high real-time requirement, the gift sending messages of the service type with low real-time requirement are delayed, so that under the condition that the live broadcast experience of a user is not influenced, the resource consumption is reduced, the operation efficiency is improved, and the gift sending messages with high real-time requirement can be processed more quickly.
In another embodiment, the service types may be further distinguished according to the degree of interaction related to the interactive content, and it can be understood that the higher the degree of interaction, the higher the corresponding real-time requirement may be.
In the embodiment of the application, the client can send the message to be processed into the message queue to wait for execution. In some embodiments, a pending message is determined from at least one gift sending message according to the service type of each gift sending message, and the pending message may be multiple, so that the multiple pending messages can be sent to the message queue after the determination.
Step S130: and executing the message to be processed to display the interactive content corresponding to the message to be processed.
The number of the messages to be processed can be one or more, each message to be processed is used for displaying or updating and displaying the corresponding interactive content, and the interactive content is determined by the service type of the message to be processed, so that the message to be processed is used for displaying or updating and displaying the interactive content corresponding to the service type of the message to be processed.
In an embodiment, the message to be processed may be stored in a message queue, the client may obtain the message to be processed from the message queue and execute the message to be processed, and since the interactive content is determined by the service type of the message to be processed, the message to be processed is executed, and the interactive content corresponding to the service type of the message to be processed may be displayed on the live broadcast interface according to the message to be processed.
For example, if the service type is "gift information showing special effect", and the message to be processed is triggered by the gift sending operation of the user on the virtual gift "lollipop", the message to be processed is executed, and the gift information showing special effect of the virtual gift "lollipop" can be displayed on the live broadcast interface. If the service type of the to-be-processed message is "PK value", and the to-be-processed message is triggered by the gift sending operation that the audience 1 sends 1314 "lollipops" to the anchor a, the to-be-processed message is executed, and the PK value of the anchor a can be updated in the live interface to be the value obtained by adding 1314 to the original PK value (such as 1000), such as 2314.
The message processing method provided by the embodiment of the application obtains at least one gift sending message, wherein the gift sending message is triggered by gift sending operation input by at least one user in a live interface of at least one live client, then determines a message to be processed from the at least one gift sending message according to the service type of each gift sending message, and finally executes the message to be processed to obtain interactive content corresponding to the message to be processed, wherein the interactive content is determined by the service type of the message to be processed. Therefore, when a user performs multiple gift sending operations in a short time and triggers a large amount of gift sending messages, the gift sending messages to be executed can be screened out according to the service types of the gift sending messages to serve as messages to be processed, and after the gift sending messages are executed, interactive contents corresponding to the service types of the messages to be processed are displayed according to the messages to be processed, so that the processing amount of the messages can be reduced in a targeted mode according to the service types, resource consumption is reduced, live broadcast display performance is optimized, and user experience is improved.
Referring to fig. 3, fig. 3 is a flowchart illustrating a message processing method according to another embodiment of the present application, which is applicable to the client, where the message processing method includes:
step S210: at least one gift giving message is obtained.
Step S220: and determining the target gift sending message according to the priority of the service type of each gift sending message.
Different priorities may be set for each traffic type depending on the importance of the different traffic types, e.g. real-time requirements. The priorities of different service types may be the same or different, and are not limited herein.
In practical application, a client participating in a live broadcast room may acquire a large amount of gift sending messages in a short time, different interactive contents in a live broadcast interface are correspondingly displayed or updated according to different service types, but the interactive contents are determined by the service types, and requirements of the different interactive contents on instantaneity may be different.
In one embodiment, for example, in the PK interaction mode, the gift sending operation of the user may correspond to gift sending messages of a plurality of different service types, for example, the service types may include, but are not limited to, "PK value", "treasure box level", "user contribution information", "baby seat level information", "gift information showing special effect 1", "trigger interactive treasure box", "trigger interactive banner", "gift information showing special effect 2", and "gift giving information".
In a specific embodiment, referring to fig. 4, fig. 4 is a schematic view of a live interface, where the live interface can display interactive content corresponding to a plurality of service types. As shown in fig. 4, the traffic types may include: the 'PK value' 401 on the PK progress bar in the live broadcast interface, the currently displayed 'PK value' 401 of the anchor A is 6570, and correspondingly, the 'PK value' of the anchor B is 1200; "BaoBox rating" 402 for Anchor A is "Lv.5"; "user contribution information" 403 may correspond to the avatar of the user currently gifting the virtual gift to the anchor, causing the PK value to grow, etc., shown as the avatar of viewer 1 in fig. 4; "seating level information" 404 may correspond to the avatar of the user that contributes second only to audience 1, shown in FIG. 4 as the avatar of audience 2; the gift information display special effect 1 is displayed 405, and pictures and the number of virtual gifts, namely lollipops, are correspondingly displayed; the 'triggering interactive treasure box' 406 corresponds to a treasure box displayed in the live broadcast interface, and when the treasure box displayed in the live broadcast interface falls, a user can obtain corresponding feedback through operation acting on the treasure box, such as obtaining reward and prompt information of a virtual gift or special opening effect of the treasure box; the ' trigger interactive banner ' 407 is correspondingly displayed with a control that ' the user A obtains 7900 glory value and the treasure box is about to fall off in the IDxxxx of the live broadcast room ' and contains a ' robbing ' word, when the live broadcast room meets specified live broadcast conditions or the user's gift delivery in the live broadcast room meets specified gift delivery conditions, the ' trigger interactive banner ' 407 can be triggered and displayed, and the treasure box can be displayed on a live broadcast interface to fall off by triggering the control; the gift information display special effect 2 is 408, and animation of virtual gift lollipop is correspondingly displayed; the "gift giving information" 409 corresponds to information that "1314 lollipops are sent by spectator 1", and the "lollipops" in the information may correspond to pictures of the virtual gift "lollipops" or characters.
Specifically, for convenience of understanding, the service types are schematically described as follows:
the transaction type "PK value" may be used to show the amount of virtual gifts that the PK parties have accumulated to receive after the PK interaction mode is turned on. For example, the "PK value" 401 shown in FIG. 4.
Service type "treasure box grade": when the PK value reaches different specified values, different treasure box grades are provided, for example, when the PK value is 0-199, it corresponds to treasure box grade 1, and when the PK value is 200-499, it can correspond to treasure box grade 2, etc. in this embodiment, no limitation is made on the mapping relationship between the PK value and the treasure box grade, and it can be determined according to actual needs. In one mode, if the gift sending operation of the user makes the PK value reach the PK value corresponding to the next treasure box level, the server may generate a gift sending message with a service type of "treasure box level" according to the gift sending operation, so that the client may obtain the gift sending message, and after the client executes the gift sending message with the service type of "treasure box level", the treasure box level displayed on the live broadcast interface may be updated, as shown in "treasure box level" 402 in fig. 4, which is displayed as "lv.5", corresponding to the treasure box level 5.
Service type "user contribution information": user information that may be used to display the virtual gifts gifted to the anchor, including, but not limited to, the user's avatar, nickname, the cumulative number of gifts the user gifted to the anchor, and the like. As shown in fig. 4, "user contribution information" 403, the avatar of viewer 1, the avatar of viewer 2, which is the main broadcast of the virtual gift, may be correspondingly displayed.
Service type "treasure box class information": after the user presents the virtual gift, the user can go to a treasure house (the user information can be displayed in a treasure house area of the live broadcast interface), and according to the presenting quantity of the virtual gift sent by the user, the treasure house grade of the user can change, for example: when the presenting quantity of the virtual gifts is between 1 and 299, Lv.1 can be correspondingly displayed corresponding to the baby seat level 1, Lv.2 can be correspondingly displayed corresponding to the baby seat level 2, the presenting quantity is between 300 and 599, and Lv.2 can be correspondingly displayed corresponding to the baby seat level 2, as shown in the 'baby box level information' 404 shown in FIG. 4, audience 1 corresponds to 'Lv.2', and audience 2 corresponds to 'Lv.1'.
Service type "gift information show special effect 1": after the user presents the virtual gift on the base, each time the gift is presented, a bounce animation appears on the base, the bounce animation is displayed after the client executes the gift sending message with the business type of 'gift information display special effect 1', and the bounce animation specifically includes but is not limited to the picture of the virtual gift presented each time and the number of the virtual gifts. For example, "gift information exhibits special effect 1" 405 as shown in fig. 4.
Service type "trigger interaction treasure box": when the PK value reaches a preset value, the server generates a gift sending message with a service type of 'trigger interactive treasure box', after the client executes the gift sending message with the service type, a 'trigger interactive treasure box' 406 shown in figure 4 can be displayed, and a user can click the treasure box to draw a lottery to obtain a prize corresponding to the treasure box.
Service type "trigger interaction banner": when the PK value reaches a preset value, the server generates a gift sending message with a service type of 'trigger interactive treasure box', the gift sending message can be sent to the client sides of users in all live broadcast rooms, when the client sides execute the gift sending message, banners can be displayed in live broadcast interfaces of the live broadcast rooms where the client sides are located, as shown in 'trigger interactive banners' 407 in fig. 4, users in other live broadcast rooms can directly enter the live broadcast room where the gift sending message is currently triggered by clicking a 'robbing' button on the banners, and therefore the treasure box can be robbed.
Service type "gift information show special effect 2": when the virtual gifts are presented by a single gift-presenting operation of a user to reach a specified number, the server generates a gift-presenting message with a service type of gift information display special effect 2 according to the gift-presenting operation, and can send the gift-presenting message to the client, when the client executes the gift-presenting message, a plurality of frames of pictures of the virtual gifts can be displayed on a live broadcast interface so as to play animation of the virtual gifts, wherein one frame of the pictures can be shown as gift information display special effect 2 408 shown in fig. 4.
Service type "gift-giving information": each time the user gives a gift, the server may generate a gift-giving message with a service type of "gift-giving information", the client executes the gift-giving message, and may display, on a live broadcast interface, a nickname of the user who gives a virtual gift, a picture or a character of the virtual gift, and a number of virtual gifts to be given, which are corresponding to the gift-giving message, as shown in "gift-giving information" 409 in fig. 4.
It should be noted that fig. 4 and the above schematic description are only exemplary, the embodiment is not limited to the above service types, and the above service types are not limited to the above functions, and the live interface may include more interactive contents, may also include less interactive contents, and may also include different interactive contents, which should not be limited in any way in this embodiment.
In one embodiment, only two priorities, i.e. a high priority and a low priority, may be set, and specifically, the traffic type with high real-time requirement may be set as the high priority and the traffic type with low real-time requirement may be set as the low priority. For example, the priority of the traffic type related to the interaction may be set to a high priority, and the priority of the traffic type not related to the interaction may be set to a low priority.
In another embodiment, multiple priorities may be further divided, for example, the priorities may be divided into 0-5 from low to high, and the service types are divided into 6 levels from low to high according to the real-time requirement of the service types, and the priorities are set to be 0-5 respectively, so that the higher the real-time requirement, the higher the priority corresponding to the service type is.
In some embodiments, a gift message having a priority greater than or equal to a preset level may be determined as the target gift message, wherein the preset level may be any value from 0 to the highest level. For example, if only two priorities, such as a high priority and a low priority, are divided, the highest level may be 1, the preset level may be any value from 0 to 1, and when the preset level is 1, the gift-giving message with the high priority may be determined as the target gift-giving message.
In other embodiments, according to the priority of the service type of each gift-giving message, different processing modes can be adopted for processing gift-giving messages with different priorities, and then the target gift-giving message is determined from at least one gift-giving message. The detailed description of the embodiments can be seen in the following examples, which are not repeated herein.
Step S230: it is determined whether the targeted gift giving message is in a non-discardable state.
The message configuration of each gift giving message may include a status field, wherein the status field is used to characterize a status of the gift giving message, and the status may include a discardable status or a non-discardable status. If the target gift sending message is in a non-discardable state, determining the target gift sending message as a message to be processed, and sending the message to a message queue to wait for execution; if the target gift-sending message is in a discardable state, the client can discard the target gift-sending message so as to filter part of the message and reduce the number of messages to be executed by the client.
It should be noted that, in the embodiment of the present application, one target gift-sending message is discarded to represent that the processing of the target gift-sending message is stopped, that is, the target gift-sending message is not sent to the message queue. The stopping process may include a stopping process without deletion, that is, the discarded target gift sending message may also be stored in a storage space of a device such as a terminal device or a server.
In addition, in some embodiments, stopping processing may further include deleting the target gift-giving message, i.e., after determining whether the target gift-giving message is in a non-discardable state, the target state message in a discardable state may also be deleted to reduce storage pressure. For example, when a gift-offering operation is triggered for multiple times, the gift-offering message obtained by the client is the latest value of the current time, so that the gift-offering message which is not processed before can be discarded, and the latest value can be used. Therefore, in the message configuration corresponding to the service type being the "PK value", the state field can correspond to a discardable state, so that when determining whether the target gift sending message is in a non-discardable state, if the gift sending message of the service type is still in the discardable state, the gift sending message can be discarded, unnecessary processing is avoided, and unnecessary resource consumption can be reduced. Further, if the gift-giving messages of the service types are executed in the order of acquiring the "PK values" without discarding them, each time the gift-giving message of the "PK values" is executed and displayed, the display may not be the current latest value, and a persistent display delay may be caused.
In one example, the status field may be 0 or 1, with 0 indicating a discardable status and 1 indicating a non-discardable status, and then based on the status field of the target gift giving message, it may be determined whether the target gift giving message is in a non-discardable status. For example, if the status field of the target gift-offering message is 0, the target gift-offering message is in a discardable status at this time, and if the target gift-offering message is 1, the target gift-offering message is in a non-discardable status at this time.
In some embodiments, since the gift-giving message is determined by the service type, and the message configuration thereof is also determined by the service type, it may be determined whether the target gift-giving message is in a non-discardable state according to the service type of the gift-giving message.
In other embodiments, the discardable state and the non-discardable state may be switched so that the status field of the gift giving message is obtained at different times and the corresponding values may be different. Therefore, to accurately determine the state of the target gift-sending message, when the state of the target gift-sending message needs to be determined, such as whether the target gift-sending message is in the non-discardable state, the state field of the target gift-sending message is obtained, and whether the target state message is in the non-discardable state is determined according to the value of the state field.
Step S240: and determining the message to be processed according to the target gift sending message in the non-discardable state.
In one embodiment, a status field of the target gift sending message may be obtained, and the target status message whose status field corresponds to a non-discardable status is sent to a message queue as a pending message to wait for execution.
Step S250: and executing the message to be processed to display the interactive content corresponding to the message to be processed.
It should be noted that, for parts not described in detail in this embodiment, reference may be made to the foregoing embodiments, and details are not described herein again.
In the message processing method provided in this embodiment, the target gift-sending message is determined according to the priority of the service type, and the target gift-sending message in the non-discardable state is determined as the message to be processed according to whether the target gift-sending message is in the non-discardable state, and the message to be processed is executed, so as to display the interactive content corresponding to the message to be processed. In the live broadcast application, the corresponding processing requirements of the gift sending messages of different service types are different, for example, the real-time requirements are different, the gift sending messages of some service types can be delayed for processing, the gift sending messages of some service types need to be processed in time, the first layer screening can be performed to obtain the target gift sending message according to the priority of the service types through priority division, and further, the second layer screening can be performed to discard the target gift sending message in a discardable state by determining whether the target gift sending message is in a discardable state, so that not only can the display delay of the continuity be avoided, but also the storage pressure is reduced, the system resource consumption is favorably reduced, and the processing efficiency is improved.
In addition, in some embodiments, after gift-giving messages with different priorities are determined according to the priorities, different processing can be performed on the gift-giving messages with different priorities, and then whether the gift-giving messages are discarded or not is determined. Specifically, the first gift-sending message with high priority can be used as a target gift-sending message for subsequent discarding judgment (whether the target gift-sending message is in a non-discarding state is determined), and the second gift-sending message with low priority needs to be scheduled to determine candidate gift-sending messages, so that the number of messages for performing subsequent discarding judgment at the same time is reduced, the processing number is reduced, and the processing load of the system is reduced. Specifically, referring to fig. 5, fig. 5 is a schematic flowchart illustrating a message processing method according to another embodiment of the present application, which is applicable to the client, where the message processing method includes:
step S310: at least one gift giving message is obtained.
Step S320: and determining a first gift sending message and a second gift sending message with different priorities according to the priority of the service type of each gift sending message.
Wherein the first gift-giving message has a higher priority than the second gift-giving message. In practical application, the gift-sending messages of different service types have different requirements on real-time performance in processing, and the service type with high real-time performance requirement can be set with higher priority, that is, the first gift-sending message can correspond to the gift-sending message of the service type with high real-time performance requirement, and the second gift-sending message can correspond to the gift-sending message of the service type with low real-time performance requirement.
In a specific embodiment, as shown in table 1, a traffic type is blank in the column of "high priority" indicating that the traffic type has low priority, and includes a "√" in the column of "high priority" indicating that the traffic type has high priority, the gift-giving message of the traffic type having high priority may correspond to a first gift-giving message, and the gift-giving message of the traffic type having priority may correspond to a second gift-giving message. As one approach, the message configuration of the gifting message may include a priority field for describing a priority, from which the priority of the gifting message may be determined to determine the first gifting message and the second gifting message. For example, the priority field of the first gift-giving message may be 1 and the priority field of the second gift-giving message may be 0.
TABLE 1
Message ID
|
Type of service
|
High priority
|
1
|
PK values
|
√
|
2
|
Treasure box grade
|
|
3
|
User contribution information
|
|
4
|
Information of grade of throne
|
|
5
|
Gift information display special effect 1
|
|
6
|
Trigger interaction treasure box
|
√
|
7
|
Triggering an interactive banner
|
√
|
8
|
Gift information display special effect 2
|
|
9
|
Gift presentation information
|
|
In a specific application scenario, for example, when a PK interaction is initiated in a live broadcast room, the service type of the gift sending message may include at least one of 9 service types as shown in table 1, where "PK value", "trigger interaction treasure box" and "trigger interaction banner" all relate to interaction and have a higher requirement on real-time performance, and therefore, the priority of the gift sending message of the aforementioned three service types may be higher than that of other service types by setting the priority of the aforementioned three service types to be high. Specifically, taking "PK value" as an example, in PK interaction, "PK value" is spelling data of PK between anchor broadcasts, and may change at any time according to a gift sending operation of a user, resulting in a change of a spelling result, and the spelling result is determined by PK value, and the party with higher PK value wins, so that the user in the live broadcast needs to pay attention to the change of PK value in real time to determine his gift sending behavior, for example, how many virtual gifts are given to the anchor broadcast, what virtual gift lamps are given to the anchor broadcast, so as to increase the supported PK value of the anchor broadcast, so that "PK value" relates to interaction and belongs to a service type with strong interactivity, and by setting high priority, a gift sending message corresponding to "PK value" can be used as a first gift sending message.
Taking the message configuration shown in table 1 as an example, if at least one gift-giving message includes the gift-giving messages of the service types in table 9 in table 1, after determining the first gift-giving message and the second gift-giving message of different priorities according to the priority of the service type of each gift-giving message, it may be determined that the first gift-giving message includes a gift-giving message corresponding to a service type of "PK value", "trigger interactive treasure box", and "trigger interactive banner", and the second gift-giving message includes a service type of "treasure box level", "user contribution information", "baby seat level information", "gift information display special effect 1", "gift information display special effect 2", and "gift-giving information".
Step S330: and scheduling the second gift sending message, and determining candidate gift sending messages from the second gift sending message.
In practical application, the importance degrees of different service types in the second gifting message with a lower priority may still be different, so that the second gifting message can be scheduled according to the importance degrees of the service types, the higher the importance degree is, the higher the proportion of the second gifting message of the service type in the candidate gifting message determined from the second gifting message is, and the higher the importance degree is, the higher the processing real-time performance of the second gifting message with the higher importance degree is in the second gifting message.
In order to further reduce the system resource consumption and optimize the live broadcast performance, the second gift sending message with lower priority can be scheduled according to the importance degree of the second gift sending message, and candidate gift sending messages are determined from the second gift sending message.
In some implementations, the importance of the second gift-giving message may be measured by a weight. Specifically, step S330 may further include steps S331 to S332, please refer to fig. 6, fig. 6 shows a schematic flow chart of step S330 in fig. 5, and the method may include:
step S331: and determining the number of messages corresponding to each weight in the second gift-giving message based on the weight of the service type of the second gift-giving message.
The weight can be used for determining the proportion of the gift-sending message corresponding to the weight in the candidate gift-sending messages, so that the weight can be divided according to the importance degree of the service type, wherein the higher the importance degree is, the higher the weight is, the lower the importance degree is, and the lower the weight is.
In some embodiments, the message configuration of the gift-giving message may further include a weight field for describing a weight of the traffic type of the gift-giving message, so the client may determine the weight of the second gift-giving message by depending on the weight field.
In other embodiments, a mapping relationship between the gift-offering message and the weight may be preset, and after the second gift-offering message is obtained, the weight of the second gift-offering message may be determined according to the mapping relationship. The mapping relationship may be a mapping relationship between a service type and a weight, or a mapping relationship between a message ID and a weight, and the like, and is not limited herein as long as the corresponding weight can be determined according to the gift-giving message. In addition, the mapping relationship may be set locally at the client, may also be set at the server, and the like, and is not limited herein.
The weights corresponding to different service types may be the same or different, and are not limited herein.
In a specific embodiment, the weight may include 5, 3, and 1 from high to low, the weight corresponding to each traffic type is as shown in table 2, if there is a square root under the weight column of the traffic type, the weight of the traffic type may be determined according to the weight value corresponding to the square root. For example, the weight of the transaction type "gift-offering information" is 5; the weights corresponding to the service types of the treasure box grade, the user contribution information and the baby seat grade information are 3, and the weights corresponding to the gift information display special effect 1 and the gift information display special effect 1 are 1.
TABLE 2
Taking the message configuration shown in table 2 as an example, if at least one gift-giving message includes 9 service types of gift-giving messages in table 1, the second gift-giving message includes service types of "treasure box level", "user contribution information", "baby seat level information", "gift information display special effect 1", "gift information display special effect 2", and "gift-giving information", and the number of messages corresponding to each weight in the second gift-giving message is determined based on the weight of the service type of the second gift-giving message.
In some embodiments, a preset value may be preset, and the number of messages corresponding to the weight may be determined according to the preset value and the weight. The preset value can be determined according to actual needs, and is not limited herein.
In order to give consideration to the processing performance of the client or the operation carrier terminal device thereof, as an implementation manner, the message quantity corresponding to each weight in the second gift-giving message may be determined according to the resource consumption information of the terminal device and the weight of the service type of the second gift-giving message. The resource consumption information is used to measure the resource consumption of the terminal device, for example, the resource consumption information may include parameters such as CPU occupancy of a Central Processing Unit (CPU) and a remaining storage space.
In one embodiment, the client may obtain the CPU occupancy to obtain the resource consumption messages, and determine the number of messages corresponding to each weight according to the CPU occupancy and the weight, specifically, the CPU occupancy ranges from 0 to 100, and the range of the current CPU occupancy may be described by a value M, and the range of the current CPU occupancy is [ M × 20, (M +1) × 20], where M belongs to [0, 4], and M belongs to N ], and if a function of the number of messages and the weight W is set to be the number of messages W (5-M), in one example, when the CPU occupancy is 70, M may be 3, then 10 second gift messages may be taken from the list with the weight of 5, 6 second gift messages may be taken from the list with the weight of 3, and 2 second gift messages may be taken from the list with the weight of 1. Therefore, the first gift sending message and the second gift sending message are determined according to the priority, on one hand, the first gift sending message with the higher priority can be processed preferentially, the interactive content corresponding to the first gift sending message is displayed in an updated mode in time, on the other hand, the second gift sending message with the lower priority can be scheduled according to the importance degree and in combination with the resource consumption condition, real-time performance and system resource configuration can be considered, the live broadcast performance is greatly optimized, the message needing the user to interact timely can be processed timely, the gift sending message without the user interacting timely can be processed in a delayed mode, therefore, when the number of the gift sending messages is too large, the message processing can be flexibly combined with the live broadcast experience of the user, the availability of the system is greatly improved, and the user experience is improved.
Step S332: and determining candidate gift sending messages corresponding to each weight according to the number of the messages corresponding to each weight.
In an embodiment, based on the weight of the service type of the second gifting message, the second gifting message may be divided according to the weight, the gifting messages with the same weight are stored in a message list, the message list is stored in correspondence with the weight, the message list may include one or more service types, and the method is not limited herein, and only the gifting messages with the corresponding number of messages may be obtained from the message list according to the weight. Specifically, as one mode, a preset value may be preset, the number of messages corresponding to the weight may be determined according to a function of the weight and the number of messages, for example, the preset value is 4, the number of messages corresponding to the weight may be a product of the weight and the preset value, as shown in table 2, the weight includes three types, i.e., 5, 3, and 1, the second gift-giving message corresponding to the business type "gift-giving information" with the weight of 5 may be stored in the message list 1, the second gift-giving message corresponding to the business type "treasure-box level", "user contribution information", and "baby-seat level information" with the weights of 3 may be stored in the message list 2, the second gift-giving message corresponding to the business type "gift-information-showing special effect 1" with the weights of 1 may be stored in the message list 3, and thus, based on a function of the weight and the preset value, the message numbers corresponding to the message lists corresponding to the weights are determined to be 20, 12 and 4 respectively, so that 20 second gift sending messages can be determined to be taken from the message list 1, 12 second gift sending messages can be taken from the message list 2, 4 second gift sending messages can be taken from the message list 3, and 36 candidate gift sending messages can be determined. It can be understood that if the number of second gifts in the message list is less than the number of messages corresponding to the weight, all second gifts in the message list can be taken out. Therefore, the candidate gift sending messages can be determined according to the weight of the service type, the second gift sending messages can be screened according to the importance degree, and the number of messages sent each time for subsequent discarding judgment is reduced.
In another embodiment, the second gift-giving messages of each service type may be stored in a message list based on the service types of the second gift-giving messages, and the weights of the service types are stored in correspondence with the message lists, so that after the number of messages is determined according to the weights, the second gift-giving messages of the corresponding number of messages may be obtained from the message list corresponding to the weights. Specifically, as one mode, a preset value may be preset, and the number of messages corresponding to the weight may be determined according to a function of the weight and the number of messages, for example, the preset value is 4, the weight of the service type "gift-offering information" is 5, and the number of messages of the service type may be a product of the weight and the preset value, that is, a product of 5 and 4, that is, 20. Therefore, the service types related to the candidate gift-sending messages can comprise the service types of all the second gift-sending messages, so that the second gift-sending messages of each service type can enter subsequent discarding judgment to be executed with opportunity, and the corresponding interactive content is updated.
It should be noted that the foregoing examples are only illustrative, and do not limit the present embodiment at all, and the function of the weights and the preset values can be set according to actual needs. In addition, the preset value can also be set according to actual needs, and is not limited herein.
In some embodiments, the schedule may have a time attribute, that is, a scheduling period may be preset to determine candidate gift sending messages from the second gift sending message at regular time for subsequent operations, so that the number of messages entering the subsequent operations at each time may be controlled to reduce the message processing required in the same time period.
The scheduling period can be determined according to actual needs, for example, the scheduling period can be adaptively adjusted according to the performance of the client, the CPU occupancy of the operation carrier terminal device of the client and other parameter information, for example, when the CPU occupancy is increased, the scheduling period can be lengthened, so that the time interval between each scheduling is increased, and when the CPU occupancy is decreased, the scheduling period can be shortened. In addition, the scheduling period may also be preset by a program, or may also be customized by a user, and is not limited herein. In one example, the scheduling period may be 500ms, such that the client may schedule the second gifting message once every 500ms, i.e., determine a candidate gifting message from the second gifting message once every 500 ms.
Step S340: and taking the first gift sending message and the candidate gift sending message as target gift sending messages.
In this embodiment, the first gift sending message and the candidate gift sending message may be sent to perform a subsequent discarding judgment, i.e., determine whether the target gift sending message is in a non-discardable state.
Specifically, in one embodiment, after determining the first gift sending message, the client may send the first gift sending message to the thread performing the discard judgment, and after determining the candidate gift sending message, the client may send the candidate gift sending message to the thread performing the discard judgment. The thread for which discarding judgment is performed is used to determine whether to execute the message by whether to discard the message, and therefore, for convenience, the thread for which discarding judgment is performed is regarded as the thread for execution.
In one embodiment, the client may send the first gifting message into the execution thread after step S320, and the client may send the candidate gifting message into the execution thread after step S330, so that the first gifting message may be executed or discarded prior to the candidate gifting message, so that the interactive content corresponding to the first gifting message may be displayed or updated in time, that is, the gifting message with higher priority may be prioritized.
In addition, when the client determines the first salutation messages one by one according to the priority of the service type of each salutation message, the salutation messages can be sent to the execution thread one by one, or after all the first salutation messages in the salutation message are finally determined, the first salutation messages are sent to the execution thread, an accumulative threshold value can be set, and when the determined accumulative number of the first salutation messages reaches the accumulative threshold value, the first salutation messages with the accumulative threshold value can be sent to the execution thread.
In some embodiments, since the candidate gifting messages may correspond to at least one weight, the order of sending the candidate gifting messages to the execution thread may be determined according to the order of the weights, and as a way, the candidate gifting messages may be sent to the execution thread in sequence according to the weights from high to low, so that the candidate gifting messages with high weights may be processed earlier, and the processing order of the candidate gifting messages may be further adjusted according to the importance, so as to further optimize the live broadcast display effect. Alternatively, the candidate gifting messages may be sequentially sent to the execution thread with weights from low to high, so that candidate gifting messages with low weights may be processed earlier. In other embodiments, the order of the execution threads may not be determined by the client according to the order of the weights, and the order of the execution threads is not limited herein.
Step S350: it is determined whether the targeted gift giving message is in a non-discardable state.
In an embodiment, a specific implementation manner of determining whether the target gift-offering message is in the non-discardable state may include steps S351 to S352, and specifically, determining whether the target gift-offering message is in the non-discardable state according to a message discarding amount that has been discarded currently, so that while resource consumption and time consumption of processing are reduced, timely processing of gift-offering messages of various service types may be monitored, thereby not only preferentially processing important messages in real time, but also timely updating of less important messages is considered, so that live broadcast performance is greatly optimized, and live broadcast experience of a user is improved. Referring to fig. 7, fig. 7 is a schematic flowchart illustrating step S350 in fig. 5, where the method may include:
step S351: and obtaining the message discarding amount corresponding to the service type of the target gift-sending message in the discardable state.
The message discarding amount is determined by the discarded gift messages of the service type, that is, the message discarding amount corresponds to the service type, and is used to accumulate the number of discarded gift messages of the service type, for example, the message discarding amount of the service type "PK value" is 10, which represents that 10 "PK value" gift messages have been discarded. In one example, each time the client discards a gift message, the client adds 1 to the message discarding amount corresponding to the gift message, thereby accumulating the message discarding amount corresponding to each traffic type.
In practical application, if a large number of gift sending operations exist in a short time, each gift sending operation can update or display corresponding interactive content on a live broadcast interface according to the service type of the corresponding gift sending message. The gift sending messages corresponding to different gift sending operations are different, for example, the gift sending messages of part of service types are generated by each gift sending operation, for example, a 'PK value', a user triggers one gift sending operation, and the PK value needs to be updated correspondingly; the gift sending messages of part of service types are generated only in a few gift sending operations, for example, when a specified live broadcast condition is met in a live broadcast room or the gift sending of a user in the live broadcast room meets the specified gift sending condition, the displayed 'trigger interactive banner', 'gift information display special effect 2' and the like are triggered. For example, if there are a lot of gift sending operations in a short time, the client may obtain a lot of gift sending messages with service types of "PK values", and each gift sending message obtained by the client is the latest value of the time, so that the gift sending messages that have not been processed before may be discarded, and the latest value may be used.
In a specific embodiment, the message configuration of the gift-giving message may include status fields, where the status fields respectively correspond to a discardable status and a non-discardable status, and the status fields may be different according to different service types. For example, the message configuration of gifting messages of 9 service types can be shown in table 2, wherein if there is a square root in one column of the discardable state, the corresponding service type is discardable, and the gifting message corresponding to the service type is in the discardable state before being sent to the execution thread; if one column of the discardable state is blank, the corresponding service type is discardable, and the gift sending message corresponding to the service type is in the discardable state before being sent to the execution thread. It should be noted that the gift-giving message may change its state when the execution thread is processed, i.e. not consistent with the state in the original message configuration.
TABLE 3
Therefore, the client can determine the target gift sending message in a discardable state by acquiring the state field of the gift sending message. Taking the message configuration shown in table 3 as an example, if at least one target gift sending message includes 9 service types of target gift sending messages in table 1, before sending into the execution thread, the target gift sending messages with service types of "PK value", "treasure box level", "user contribution information", and "baby seat level information" are in a discardable state, and the target gift sending messages with other service types in table 2 may be in a non-discardable state.
Step S352: and when the message discarding amount is not less than the discarding threshold value, switching the discardable state of the target gift sending message into the non-discardable state.
In practical application, if too many gift sending messages of a service type are discarded, the live broadcast interface will not update or display the interactive content corresponding to the service type at a later time, and viewing experience is affected. For example, if too many gift sending messages for "PK value" are discarded, it may result in multiple gift sending actions actually occurring, the user triggering multiple gift sending operations, but not updating the PK value late on the live interface. Therefore, in some embodiments, the discarding amount of the message may be monitored by setting a discarding threshold, so that when the discarding amount of the message is not less than the losing threshold, the message is not discarded but executed to update the PK value corresponding to the message to the live broadcast interface, thereby effectively controlling the delay, avoiding too long delay caused by too much discarding of the message, reducing resource consumption, and improving processing efficiency.
The loss threshold is used for monitoring the number of discarded gift sending messages of the service type according to the service type, the discard threshold can be determined according to actual needs, for example, the discard threshold can be adaptively adjusted according to the resource consumption information, when the resource consumption corresponding to the resource consumption information is high, the discard threshold can be increased, when the resource consumption corresponding to the resource consumption information is low, the discard threshold can be decreased, and the specific setting mode is not limited herein. In addition, the loss threshold may also be preset by a program or customized by a user, for example, the loss threshold may be 5, 10, 20, and the like, which is not limited in this embodiment.
In some embodiments, the discard thresholds of different traffic types may be different, and in particular, the message configuration of the gift sending message may further include a discard threshold, where the discard threshold corresponds to a traffic type, and thus the message discard amount may be monitored according to requirements of different traffic types, respectively.
In this embodiment, when the message discarding amount is not less than the discarding threshold, the discardable state of the target gift sending message is switched to the discardable state, so that the target gift sending message can be determined as a to-be-processed message to wait for execution. Thus, when the gift sending message of one service type is discarded too much and is not less than the discarding threshold value, the gift sending message of the service type can be executed once so as to avoid too much delay caused by discarding too much.
In one embodiment, the status field of the target gift-giving message may be changed, for example, to change 0, which characterizes the discardable status, to 1, which is the non-discardable status, so that the target gift-giving message may be determined to be a pending message to wait for execution.
In some embodiments, when the message discarding amount is not less than the discarding threshold, the message discarding amount corresponding to the target gift sending message may be further updated, and the message discarding amount corresponding to the target gift sending message is set to zero, so as to re-accumulate the message discarding amount. Because the target gift-sending message can be switched to the non-discardable state and can be executed when the message discarding amount is not less than the discarding threshold value, at this time, by setting the message discarding amount corresponding to the service type of the target gift-sending message to zero, the next wheel can continue to monitor the message discarding amount corresponding to the service type, so that when the next accumulated message discarding amount reaches the discarding threshold value, the gift-sending message of the service type is executed again.
Step S360: and determining the message to be processed according to the target gift sending message in the non-discardable state.
In some embodiments, after determining whether the target gift-giving message can be discarded, the target gift-giving message that can be discarded can be deleted, so that while unnecessary messages are reduced for processing, system storage can be optimized, consumption of computing resources of storage resources of the system storage can be reduced, and processing performance of the client and the operation carrier terminal device of the client can be further optimized.
Step S370: and executing the message to be processed to display the interactive content corresponding to the message to be processed.
It should be noted that, for parts not described in detail in this embodiment, reference may be made to the foregoing embodiments, and details are not described herein again.
In the message processing method provided by this embodiment, the gifts with different priorities, that is, the first gifts and the second gifts, are determined according to the priorities, and after the gifts with different priorities are processed differently, whether the gifts are discarded is determined, specifically, the second gifts with lower priorities are discarded after candidate gifts are determined by scheduling, and the first gifts with higher priorities are directly discarded, so that the first gifts with high priorities can be processed preferentially, and the second gifts can be processed partially by scheduling the second gifts, thereby effectively reducing the processing amount of the low-priority gifts in each time period, improving and transmitting processing efficiency, ensuring real-time processing of the high-priority gifts, and updating the interactive content corresponding to the high-priority gifts in real time, the live performance is greatly optimized.
Furthermore, after the target gift sending message is determined, whether the target gift sending message can be discarded or not can be determined according to the discarded message amount discarded currently, so that the phenomenon that too much gift sending messages of the same service type are discarded and the interactive content corresponding to the service type cannot be updated later and display delay is caused can be avoided.
In addition, in some embodiments, before obtaining the message discarding amount to determine whether the message discarding amount is greater than the discarding threshold, it may also be determined first whether the number of messages corresponding to the discardable service type in the target gift-giving message exceeds the discarding threshold, and when the number of messages corresponding to the service type exceeds the discarding threshold, the message discarding amount corresponding to the service type is obtained again to determine whether enough messages of the service type have been discarded, if so, the target gift-giving message is executed, otherwise, the message discarding amount is discarded. Therefore, the phenomenon that too much information of a certain service type is discarded to cause too much processing delay on the information of the service type can be avoided, the phenomenon that the interactive content corresponding to the service type is not updated after being delayed for too long can be avoided, the resource consumption is reduced by discarding the information, meanwhile, the information can be updated in time, and the processing efficiency can be improved and the system resource consumption can be reduced under the condition that the normal live broadcast watching of a user is not influenced. Specifically, referring to fig. 8, fig. 8 shows a message processing method provided in an embodiment of the present application, which is applicable to the client, where the method specifically includes:
step S401: at least one gift giving message is obtained.
Step S402: and determining a first gift sending message and a second gift sending message with different priorities according to the priority of the service type of each gift sending message.
Step S403: and determining the number of messages corresponding to each weight in the second gift-giving message based on the weight of the service type of the second gift-giving message.
Step S404: and determining candidate gift sending messages corresponding to each weight according to the number of the messages corresponding to each weight.
Step S405: and taking the first gift sending message and the candidate gift sending message as target gift sending messages.
In one embodiment, the target gift-offering message may include a gift-offering message in a discardable state and a gift-offering message in a non-discardable state, and the step S412 may be directly performed for the gift-offering message in the non-discardable state.
Since steps S406 to S411 are used to monitor the gifting message of the discardable service type, it is avoided that the gifting message of the discardable service type is not updated for a long time, which causes a large delay. Therefore, the gift-offering message determined to be in the non-discardable state may perform steps S406 to S411, and directly perform step S412, so as to speed up the processing of the gift-offering message in the non-discardable state, to improve the speed of updating or displaying, and to improve the real-time performance.
In an example, referring to table 3, the state corresponding to the service type "gift information showing special effect 1", "trigger interactive treasure box", "trigger interactive banner", "gift information showing special effect 2", and "gift giving information" is a non-discardable state, so that the client may obtain the target gift giving message in the non-discardable state from the target gift giving information, and perform step S412, determine the target gift giving message in the non-discardable state as a message to be processed, and send the message to the message queue to wait for execution. Therefore, the unreleasable gift sending message in the target gift sending message can be preferentially executed, the corresponding interactive content in the live broadcast interface is updated or displayed in time, for example, the target gift sending message comprises a gift sending message with a business type of 'gift information display special effect 2', the gift sending message can be sent into a message queue, and the gift information display special effect corresponding to the gift sending message can be displayed on the live broadcast interface by executing the gift sending message, for example, an image of 'lollipop' is displayed.
Step S406: and acquiring the message quantity corresponding to the service type of the target gift-sending message in the discardable state.
Step S407: and judging whether the message quantity corresponding to the service type of the target gift-sending message in the discardable state is greater than a discarding threshold value.
In this embodiment, before obtaining the message discarding amount to determine whether the message discarding amount is greater than the discarding threshold, it may also be first obtained whether the message amount of the target gift-sending message of the same service type and in the discardable state exceeds the discarding threshold corresponding to the service type, and when not exceeding, it may be obtained again to determine whether a sufficient number of messages of the service type have been discarded, and when exceeding, at least one of the target gift-sending messages may be directly executed as a message to be processed. Therefore, under the condition that a large number of same service types are obtained by a client at one time and the service types can be discarded, the judgment of the discarded message amount is skipped, and the gift sending message of the service types is directly executed first, so that the processing efficiency can be improved, the delay is further reduced on the basis of reducing the resource consumption, and the live broadcast performance is optimized.
For example, the service type "PK value" is discardable, and the corresponding discarding threshold is 10, at this time, if the target gifting message includes 12 gifting messages with the service type "PK value", the number of the messages is greater than the discarding threshold, at this time, at least one "PK value" gifting message may be determined as a message to be processed, and sent to the message queue to wait for execution. And as a way of doing so, a newly acquired "PK-value" gift-giving message may be enqueued to the message queue such that the displayed PK-value is updated to the latest PK-value based on the gift-giving message.
In this embodiment, after determining whether the number of messages corresponding to the service type of the target gift-offering message in the discardable state is greater than the discard threshold, the method may include:
when the number of messages is not greater than the discard threshold, step S408 may be performed;
when the number of messages is greater than the discard threshold, step S411 may be performed.
Further, in some embodiments, when the number of messages is not greater than the discard threshold, the message discard amount corresponding to the traffic type of the target gifting message may also be set to zero to re-accumulate the message discard amount, so that when the message discard amount is accumulated to be greater than or equal to the discard threshold, the number of messages that need to be executed may be reduced by discarding the target gifting message of the traffic type, so as to reduce the processing burden and resource consumption.
Step S408: and obtaining the message discarding amount corresponding to the service type of the target gift-sending message in the discardable state.
Step S409: and judging whether the message discarding amount corresponding to the service type of the target gift-sending message is less than a discarding threshold value.
In this embodiment, after determining whether the message discard amount corresponding to the service type of the target gift-offering message is smaller than the discard threshold, the method may include:
when the message discarding amount is less than the discarding threshold, step S410 may be performed;
when the message discard amount is not less than the discard threshold, step S411 may be performed.
Step S410: and discarding the target gift sending message in a discardable state.
And when the message discarding amount is less than the discarding threshold value, discarding the target gift sending message in the disposable state.
Step S411: and switching the discardable state of the target gift sending message into the non-discardable state.
The client may enable the target gift-giving message to be executed as a pending message by switching the discardable state of the target gift-giving message to a non-discardable state.
In one embodiment, the discardable state of the target gift giving message may be switched to the non-discardable state when the number of messages is greater than a discard threshold.
In another embodiment, the discardable state of the target gift giving message may be switched to the non-discardable state when the message discard amount is not less than the discard threshold.
It should be noted that, in some embodiments, when the number of messages is greater than the discard threshold, or when the discard amount of messages is not less than the discard threshold, the client may not switch the state of the target gift-sending message, and may not change the state field, but directly send the target gift-sending message to the message queue to be executed as the pending message. The method of executing the gifting message in the discardable state by switching the states is only one embodiment, and is not limited to this embodiment.
Step S412: and determining the message to be processed according to the target gift sending message in the non-discardable state.
Step S413: and executing the message to be processed to display the interactive content corresponding to the message to be processed.
It should be noted that, for parts not described in detail in this embodiment, reference may be made to the foregoing embodiments, and details are not described herein again.
Referring to fig. 9, a block diagram of a message processing apparatus 900 according to an embodiment of the present disclosure is shown, where the message processing apparatus 900 may include: a message acquisition module 910, a message determination module 920, and a message execution module 930.
A message obtaining module 910, configured to obtain at least one gift sending message, where the gift sending message is triggered by a gift sending operation input by at least one user in a live interface of at least one live client;
a message determining module 920, configured to determine a to-be-processed message from the at least one gift sending message according to a service type of each gift sending message;
a message executing module 930, configured to execute the to-be-processed message to display an interactive content corresponding to the to-be-processed message, where the interactive content is determined by a service type of the to-be-processed message.
Further, the message determination module 920 includes: a priority sub-module, a status determination sub-module and a message determination sub-module, wherein:
the priority submodule is used for determining a target gift sending message according to the priority of the service type of each gift sending message;
the state determining submodule is used for determining whether the target gift sending message is in a non-discardable state;
and the message determining submodule is used for determining the message to be processed according to the target gift sending message in the non-discardable state.
Further, the priority submodule may include: a prioritization unit, and a target determination unit, wherein:
a priority classification unit, configured to determine, according to a priority of a service type of each of the gift-giving messages, a first gift-giving message and a second gift-giving message of different priorities, where the priority of the first gift-giving message is higher than the priority of the second gift-giving message;
the priority dividing unit is used for scheduling the second gift sending message and determining candidate gift sending messages from the second gift sending message;
and the target determining unit is used for taking the first gift sending message and the candidate gift sending message as target gift sending messages.
Further, after determining whether the target gift-offering message is in a non-discardable state, the message processing apparatus 900 further includes: a message deletion module, wherein:
and the message deleting module is used for deleting the target gift-sending message in a discardable state.
Further, the state determination sub-module may include: a discard acquisition unit and a discard switching unit, wherein:
the system comprises a discarding obtaining unit, a discarding obtaining unit and a judging unit, wherein the discarding obtaining unit is used for obtaining a message discarding amount corresponding to the service type of a target gift sending message in a discardable state, and the message discarding amount is determined by the discarded gift sending message of the service type;
and the discarding switching unit is used for switching the discardable state of the target gift sending message into the non-discardable state when the message discarding amount is not less than the discarding threshold value.
Further, before obtaining the message discard amount corresponding to the service type of the target gift-sending message in the discard state, the message processing apparatus 900 further includes: quantity acquisition module and quantity switching module, wherein:
the quantity obtaining module is used for obtaining the message quantity corresponding to the service type of the target gift sending message in a discardable state;
and the quantity switching module is used for switching the discardable state of the target gift sending message into the non-discardable state when the quantity of the messages is not greater than the discarding threshold value.
Further, the prioritization unit may include: a quantity determination subunit and a message determination subunit, wherein:
a quantity determining subunit, configured to determine, based on the weight of the service type of the second gift-offering message, a message quantity corresponding to each weight in the second gift-offering message;
and the message determining subunit is used for determining the candidate gift-sending message corresponding to each weight according to the number of the messages corresponding to each weight.
Further, the number determination subunit may include: a resource determination subunit, wherein:
and the resource determining subunit is configured to determine, according to the resource consumption information of the terminal device and the weight of the service type of the second gift-offering message, a message quantity corresponding to each weight in the second gift-offering message.
The message processing apparatus provided in the embodiment of the present application is used to implement the corresponding message processing method in the foregoing method embodiment, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
In the several embodiments provided in the present application, the coupling between the modules may be electrical, mechanical or other type of coupling.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
Referring to fig. 10, a block diagram of an electronic device according to an embodiment of the present application is shown. The electronic device 1000 may be an electronic device capable of running an application, such as a smart phone, a tablet computer, and an electronic book. The electronic device 1000 in the present application may include one or more of the following components: a processor 1010, a memory 1020, and one or more applications, wherein the one or more applications may be stored in the memory 1020 and configured to be executed by the one or more processors 1010, the one or more programs configured to perform a method as described in the aforementioned method embodiments.
Processor 1010 may include one or more processing cores. The processor 1010 interfaces with various components throughout the electronic device 1000 using various interfaces and circuitry to perform various functions of the electronic device 1000 and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 1020 and invoking data stored in the memory 1020. Alternatively, the processor 1010 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 1010 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 1010, but may be implemented by a communication chip.
The Memory 1020 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 1020 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 1020 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like. The data storage area may also store data created by the electronic device 1000 during use (e.g., phone book, audio-video data, chat log data), and the like.
Referring to fig. 11, a block diagram of a computer-readable storage medium according to an embodiment of the present disclosure is shown. The computer-readable storage medium 1100 stores therein program code that can be called by a processor to execute the methods described in the above-described method embodiments.
The computer-readable storage medium 1100 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable and programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 1100 includes a non-volatile computer-readable storage medium. The computer readable storage medium 1100 has storage space for program code 1110 for performing any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 1110 may be compressed, for example, in a suitable form.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not necessarily depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.