WO2021073248A1 - 消息发送方法、装置、可读介质及电子设备 - Google Patents

消息发送方法、装置、可读介质及电子设备 Download PDF

Info

Publication number
WO2021073248A1
WO2021073248A1 PCT/CN2020/110041 CN2020110041W WO2021073248A1 WO 2021073248 A1 WO2021073248 A1 WO 2021073248A1 CN 2020110041 W CN2020110041 W CN 2020110041W WO 2021073248 A1 WO2021073248 A1 WO 2021073248A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
messages
message type
current
target client
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2020/110041
Other languages
English (en)
French (fr)
Inventor
刘庆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to JP2022522866A priority Critical patent/JP7454662B2/ja
Priority to KR1020227012470A priority patent/KR102725987B1/ko
Priority to EP20877202.0A priority patent/EP4047934B1/en
Priority to BR112022007289A priority patent/BR112022007289A2/pt
Priority to US17/769,739 priority patent/US12075106B2/en
Publication of WO2021073248A1 publication Critical patent/WO2021073248A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/226Delivery according to priorities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/231Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
    • H04N21/23106Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion involving caching operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/262Content or additional data distribution scheduling, e.g. sending additional data at off-peak times, updating software modules, calculating the carousel transmission frequency, delaying a video stream transmission, generating play-lists
    • H04N21/26208Content or additional data distribution scheduling, e.g. sending additional data at off-peak times, updating software modules, calculating the carousel transmission frequency, delaying a video stream transmission, generating play-lists the scheduling operation being performed under constraints
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/16Arrangements for providing special services to substations
    • H04L12/18Arrangements for providing special services to substations for broadcast or conference, e.g. multicast
    • H04L12/1813Arrangements for providing special services to substations for broadcast or conference, e.g. multicast for computer conferences, e.g. chat rooms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/8547Content authoring involving timestamps for synchronizing content

Definitions

  • the present disclosure relates to the field of communication technologies, and in particular, to a method, device, readable medium, and electronic equipment for sending messages.
  • the present disclosure provides a message sending method, the method includes:
  • the current message is cached in the target cache queue corresponding to the current message, wherein each message in the target cache queue has an associated Timestamp
  • the current message is sent to the target Client, wherein the target client is the recipient of the current message.
  • a message sending device which includes:
  • the determining module is configured to determine the message type of the current message received within the current time window, and the message type is divided into a first message type and a second message type;
  • the cache module is configured to, if the determined message type is the first message type, cache the current message in a target cache queue corresponding to the current message, wherein Each message has an associated time stamp;
  • the sending module is configured to send the current message if the determined message type is the second message type, and the total number of messages sent to the target client within the current time window does not reach a first preset threshold. Sent to the target client, where the target client is the recipient of the current message.
  • the present disclosure provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the steps of any one of the methods in the first aspect are implemented.
  • an electronic device including:
  • a storage device on which a computer program is stored
  • the processing device is configured to execute the computer program in the storage device to implement the steps of any one of the methods in the first aspect.
  • the message type of the current message received is first determined. If the current message is the first message type, it is cached in the corresponding target cache queue; if the current message is the second message type, the total number of messages sent in the current time window does not reach the first preset threshold To send the current message to the target client. In this way, by controlling the number of messages sent to the target client, network congestion can be effectively avoided and network resources can be saved. In addition, different message processing methods are adopted for different message types, which can make the processing of different types of messages more targeted.
  • Fig. 1 is a flow chart showing a method for sending a message according to an exemplary embodiment.
  • Fig. 2 is a flow chart showing a method for sending a message according to another exemplary embodiment.
  • Fig. 3 is a block diagram showing a message sending device according to an exemplary embodiment.
  • Fig. 4 is a schematic diagram showing the structure of an electronic device according to an exemplary embodiment.
  • chat messages in a live broadcast room have relatively low real-time requirements.
  • the leaderboard news in the live broadcast room has relatively high requirements for real-time performance.
  • the server sends a message to the user client, it needs to send the latest message, so as to ensure that the user can get the latest information through the leaderboard message. The ranking situation.
  • Fig. 1 is a flow chart showing a method for sending a message according to an exemplary embodiment. This method can be applied to servers, such as cloud servers, message management servers, live broadcast platforms, and so on. As shown in Figure 1, the message sending method may include:
  • the preset duration corresponding to a time window can be preset, for example, the preset duration can be set to 1s.
  • the server after the server receives the current message, it can determine the message type of the current message.
  • the message type can be divided into a first message type and a second message type.
  • messages belonging to the first message type have relatively high requirements for real-time performance
  • messages belonging to the second message type have relatively low requirements for real-time performance.
  • the message sending method may be applied to a live broadcast platform, for example.
  • messages belonging to the first message type may include at least one of the following: leaderboard messages, like messages, emoticons, etc.
  • messages belonging to the second message type may include at least one of the following: chat messages , Barrage messages, gift-giving messages, etc.
  • the target cache queue is a cache queue corresponding to the current message, for example, a Redis (Remote Dictionary Server, remote data service) cache queue may be used for storage.
  • the messages belonging to the first message type are all set with their corresponding buffer queues. For example, if the current message is a like message, the message can be cached in the buffer queue corresponding to the like message. If the current message is a leaderboard message, the message can be cached in the cache queue corresponding to the leaderboard message. If the current message is an emoticon message, the message can be cached in the cache queue corresponding to the emoticon message.
  • each message cached in the target cache queue has an associated time stamp.
  • the timestamp can identify the time when each message is received by the server. For example, the timestamp can be used to identify that in the current 1s, a message was received in the 100th ms, or a message was received in the 500th ms.
  • the time stamp can also be used to characterize the order in which each message in the cache queue is received. By buffering the messages received in the current time window into the target buffer queue, the latest message received in the current time window can be further found.
  • the target client may be the recipient of the current message, for example, the client of a user watching the live broadcast, and the client may be, for example, a smart phone, a notebook computer, a desktop computer, or the like. Since the target client's ability to receive messages is limited, and some messages are of low importance, they do not need to be sent to the target client. If too many messages are sent to the target client, not only will it cause a waste of resources, but it will also be prone to network congestion. Therefore, it is necessary to control the total number of messages sent by the server to the target client within a time window. Specifically, the first preset threshold may represent the upper limit of the number of messages that can be sent to the target client in the current time window.
  • the first preset threshold can be set as required. For example, it can be set according to the priority of messages belonging to the second message type. Wherein, the first preset threshold corresponding to the high-priority message is higher than the first preset threshold corresponding to the low-priority message.
  • the first preset threshold corresponding to the barrage message is higher than the first preset threshold corresponding to the chat message.
  • the upper limit of the number of barrage messages that can be sent to the target client is set to 200
  • the upper limit of the number of chat messages that can be sent is set to 150
  • the upper limit of the number of gift messages that can be sent The value is set to 100.
  • the upper limit values of chat messages, barrage messages, and gift messages may also be set to 450, and their respective upper limit values are not limited.
  • the message type of the current message received is first determined. If the current message is the first message type, it is cached in the corresponding target cache queue; if the current message is the second message type, the total number of messages sent in the current time window does not reach the first preset threshold To send the current message to the target client. In this way, by controlling the number of messages sent to the target client, network congestion can be effectively avoided and network resources can be saved. In addition, different message processing methods are adopted for different message types, which can make the processing of different types of messages more targeted.
  • Fig. 2 is a flow chart showing a method for sending a message according to another exemplary embodiment. As shown in Figure 2, optionally, if the determined message type is the first message type, the method may further include:
  • the length of the time window is 1s.
  • the messages received within 1s stored in the target cache queue can be sorted according to the timestamp from late to early, and the top N messages are The N messages closest to the current time.
  • the server can send the N messages to the target client.
  • N is a positive integer
  • the maximum value of N is the second preset threshold.
  • the second preset threshold may be set according to actual needs. For example, for leaderboard messages, the second preset threshold may be set to 100. For emoticons, the second preset threshold can be set to 120. For like messages, the second preset threshold may be set to 150.
  • the message sent to the target client is the message closest to the current time, ensuring that the message received by the target client is the latest message.
  • the maximum value of N can be the second preset threshold, which can effectively control the number of messages sent to the target client, thereby effectively avoiding network congestion.
  • the method may further include:
  • the target cache queue needs to receive messages in the next time window. Therefore, after N messages are sent to the target client, the N messages need to be removed from the target cache queue to facilitate
  • the target buffer queue can receive the message of the next time window in time, thereby ensuring the normal processing and sending of the message of the next time window.
  • the N messages can be removed by setting a timed automatic clearing method, for example, the messages in the cache queue are cleared once every time window (eg, 1s).
  • S14 may include:
  • the N messages with the timestamp closest to the current time are sent to the target client.
  • the messages in the target cache queue can be synchronized to the memory, and the memory can be, for example, the system memory of the message management server.
  • the message can be synchronized from the cache queue to the system memory through the intermediate service layer, which is located between the cache and the system memory, and can play the role of message synchronization and forwarding. Since the storage space of the system memory is large, and the capacity expansion operation can be performed as required, it can satisfy the message processing operation when the amount of data is large.
  • the N messages with the time stamp closest to the current time are sent to the target client.
  • the messages received in the current time window can be sorted according to the timestamp, and then the N messages closest to the current time can be determined, and N is a positive integer, and the maximum value of N is the second preset threshold. .
  • the method may further include:
  • the current message may be discarded.
  • the receiving capacity of the target client and the transmission capacity of the network are both limited. If too many messages are sent, it is easy to cause network congestion and network delay. Therefore, if the total number of messages sent to the target client within the current time window has reached the first preset threshold, the server may discard the current message without storing or processing the current message.
  • the storage resources of the server can be saved, and the number of messages sent to the target client can be effectively controlled, thereby saving network resources and avoiding network congestion.
  • Fig. 3 is a block diagram showing a message sending device according to an exemplary embodiment.
  • the apparatus 300 may include:
  • the determining module 301 is configured to determine the message type of the current message received within the current time window, and the message type is divided into a first message type and a second message type;
  • the buffer module 302 is configured to, if the determined message type is the first message type, buffer the current message in a target buffer queue corresponding to the current message, wherein the target buffer queue is Each message of has an associated timestamp;
  • the sending module 303 is configured to: if the determined message type is the second message type, and the total number of messages sent to the target client within the current time window does not reach a first preset threshold, then the current The message is sent to the target client, where the target client is the recipient of the current message.
  • the message type of the current message received is first determined. If the current message is the first message type, it is cached in the corresponding target cache queue; if the current message is the second message type, the total number of messages sent in the current time window does not reach the first preset threshold To send the current message to the target client. In this way, by controlling the number of messages sent to the target client, network congestion can be effectively avoided and network resources can be saved. In addition, different message processing methods are adopted for different message types, which can make the processing of different types of messages more targeted.
  • the sending module 303 is further configured to, if the determined message type is the first message type, at the end of the current time window, set the time stamp in the target cache queue to the current time
  • the most recent N messages are sent to the target client, where N is a positive integer, and the maximum value of N is the second preset threshold.
  • the device 300 may further include:
  • the removing module is configured to remove the N messages from the target cache queue after the N messages are sent to the target client.
  • the sending module 303 may include:
  • Synchronization sub-module used to synchronize the messages in the target buffer queue to the memory
  • the sending submodule is configured to send the N messages with the time stamp closest to the current time in the memory to the target client.
  • the device 300 may further include:
  • a discarding module configured to discard if the determined message type is the second message type, and the total number of messages sent to the target client within the current time window has reached the first preset threshold The current message.
  • FIG. 4 shows a schematic structural diagram of an electronic device 400 suitable for implementing embodiments of the present disclosure.
  • the electronic device shown in FIG. 4 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
  • the electronic device 400 may include a processing device (such as a central processing unit, a graphics processor, etc.) 401, which may be loaded into a random access device according to a program stored in a read-only memory (ROM) 402 or from a storage device 408.
  • the program in the memory (RAM) 403 executes various appropriate actions and processing.
  • various programs and data required for the operation of the electronic device 400 are also stored.
  • the processing device 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404.
  • An input/output (I/O) interface 405 is also connected to the bus 404.
  • the following devices can be connected to the I/O interface 405: including input devices 406 such as touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; including, for example, liquid crystal displays (LCD), speakers, vibration An output device 407 such as a device; a storage device 408 such as a magnetic tape, a hard disk, etc.; and a communication device 409.
  • the communication device 409 may allow the electronic device 400 to perform wireless or wired communication with other devices to exchange data.
  • FIG. 4 shows an electronic device 400 having various devices, it should be understood that it is not required to implement or have all of the illustrated devices. It may alternatively be implemented or provided with more or fewer devices.
  • the process described above with reference to the flowchart can be implemented as a computer software program.
  • the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, and the computer program includes program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402.
  • the processing device 401 the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
  • the aforementioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or a combination of any of the above. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier wave, and a computer-readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium.
  • the computer-readable signal medium may send, propagate, or transmit the program for use by or in combination with the instruction execution system, apparatus, or device .
  • the program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wire, optical cable, RF (Radio Frequency), etc., or any suitable combination of the above.
  • the server can communicate with any currently known or future-developed network protocol such as HTTP (HyperText Transfer Protocol), and can communicate with any form or medium of digital data (for example, , Communication network) interconnection.
  • HTTP HyperText Transfer Protocol
  • Examples of communication networks include local area networks ("LAN”), wide area networks (“WAN”), the Internet (for example, the Internet), and end-to-end networks (for example, ad hoc end-to-end networks), as well as any currently known or future research and development network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist alone without being assembled into the electronic device.
  • the aforementioned computer-readable medium carries one or more programs, and when the aforementioned one or more programs are executed by the electronic device, the electronic device:
  • the current message is cached in the target cache queue corresponding to the current message, wherein each message in the target cache queue has an associated Timestamp
  • the current message is sent to the target Client, wherein the target client is the recipient of the current message.
  • the computer program code used to perform the operations of the present disclosure can be written in one or more programming languages or a combination thereof.
  • the above-mentioned programming languages include but are not limited to object-oriented programming languages such as Java, Smalltalk, C++, and Including conventional procedural programming languages-such as "C" language or similar programming languages.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server.
  • the remote computer can be connected to the user’s computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to Connect via the Internet).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagram may represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logical function Executable instructions.
  • the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
  • the modules involved in the embodiments described in the present disclosure can be implemented in software or hardware. Among them, the name of the module does not constitute a limitation on the module itself under certain circumstances. For example, the determining module can also be described as a "determining unit" and so on.
  • exemplary types of hardware logic components include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Product (ASSP), System on Chip (SOC), Complex Programmable Logical device (CPLD) and so on.
  • FPGA Field Programmable Gate Array
  • ASIC Application Specific Integrated Circuit
  • ASSP Application Specific Standard Product
  • SOC System on Chip
  • CPLD Complex Programmable Logical device
  • a machine-readable medium may be a tangible medium, which may contain or store a program for use by the instruction execution system, apparatus, or device or in combination with the instruction execution system, apparatus, or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • the machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing.
  • machine-readable storage media would include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • RAM random access memory
  • ROM read-only memory
  • EPROM or flash memory erasable programmable read-only memory
  • CD-ROM compact disk read-only memory
  • magnetic storage device or any suitable combination of the above.
  • Example 1 provides a message sending method, the method includes: determining a message type of a current message received within a current time window, the message type being divided into a first message Type and a second message type; if the determined message type is the first message type, the current message is cached in a target cache queue corresponding to the current message, wherein the target cache queue Each message in has an associated time stamp; if the determined message type is the second message type, and the total number of messages sent to the target client within the current time window does not reach the first preset threshold, The current message is sent to the target client, where the target client is the recipient of the current message.
  • Example 2 provides the method of Example 1. If the determined message type is the first message type, the method further includes:
  • the N messages with the closest timestamp to the current time in the target cache queue are sent to the target client, where N is a positive integer, and the maximum value of N is the second preset Set the threshold.
  • Example 3 provides the method of Example 2. After sending the N messages to the target client, the method further includes: removing the N messages from the target cache queue. N messages.
  • Example 4 provides the method of Example 2.
  • the sending to the target client N messages with a timestamp closest to the current time in the target cache queue includes: The messages in the target cache queue are synchronized to the memory; in the memory, the N messages with the time stamp closest to the current time are sent to the target client.
  • Example 5 provides the method of Example 1. If the determined message type is the second message type, the method further includes: if the current time window is If the total number of messages sent internally to the target client has reached the first preset threshold, the current message is discarded.
  • Example 6 provides the method of any one of Examples 1 to 5, which is applied to a live broadcast platform, and messages belonging to the first message type include at least one of the following: Leaderboard messages, like messages, and emoticons; messages belonging to the second message type include at least one of the following: chat messages, barrage messages, and gift-giving messages.
  • Example 7 provides the method of Example 6.
  • the first preset threshold is set according to the priority of the message belonging to the second message type, wherein the higher priority
  • the first preset threshold corresponding to the message is higher than the first preset threshold corresponding to the message with a low priority.
  • Example 8 provides a message sending device, the device includes: a determining module configured to determine the message type of the current message received within the current time window, the message type Divided into a first message type and a second message type; a cache module, configured to cache the current message in the target cache corresponding to the current message if the determined message type is the first message type In the queue, each message in the target buffer queue has an associated timestamp; the sending module is configured to, if the determined message type is the second message type, and send the message within the current time window If the total number of messages sent by the target client does not reach the first preset threshold, the current message is sent to the target client, where the target client is the recipient of the current message.
  • Example 9 provides a computer-readable medium having a computer program stored thereon, and when the program is executed by a processing device, it implements the method described in any one of Examples 1 to 7. step.
  • Example 10 provides an electronic device, including: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to The steps of the method described in any one of Examples 1 to 7 are implemented.

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

本公开涉及一种消息发送方法、装置、可读介质及电子设备。该方法包括:确定在当前时间窗口内接收到的当前消息的消息类型,消息类型分为第一消息类型和第二消息类型;若确定出的消息类型为第一消息类型,则将当前消息缓存到与当前消息对应的目标缓存队列中,其中,目标缓存队列中的各消息具有相关联的时间戳;若确定出的消息类型为第二消息类型,且在当前时间窗口内向目标客户端发送的消息总数未达到第一预设阈值,则将当前消息发送至目标客户端。如此,通过控制发送至目标客户端的消息数量,可以有效避免网络拥塞现象,节约网络资源。并且,对于不同的消息类型,分别采用不同的消息处理方式,可以使得对于不同类型的消息的处理更有针对性。

Description

消息发送方法、装置、可读介质及电子设备
相关申请的交叉引用
本申请要求于2019年10月16日提交的,申请号为201910985122.3、发明名称为“消息发送方法、装置、可读介质及电子设备”的中国专利申请的优先权,该申请的全文通过引用结合在本申请中。
技术领域
本公开涉及通信技术领域,具体地,涉及一种消息发送方法、装置、可读介质及电子设备。
背景技术
随着网络用户的不断增多,例如,有的直播平台会出现几百万用户同时在线的情况,这时网络上传输的消息数量也呈爆发式的增长。然而用户客户端的接收能力是有限的,并且网络的传输能力也是有限的,如果服务器把所有的消息都推送至用户客户端,容易占用过多的网络资源,使得网络资源浪费,并且容易造成网络拥塞现象。
发明内容
提供该发明内容部分以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该发明内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。
第一方面,本公开提供一种消息发送方法,所述方法包括:
确定在当前时间窗口内接收到的当前消息的消息类型,所述消息类型分为第一消息类型和第二消息类型;
若确定出的所述消息类型为所述第一消息类型,则将所述当前消 息缓存到与所述当前消息对应的目标缓存队列中,其中,所述目标缓存队列中的各消息具有相关联的时间戳;
若确定出的所述消息类型为所述第二消息类型,且在所述当前时间窗口内向目标客户端发送的消息总数未达到第一预设阈值,则将所述当前消息发送至所述目标客户端,其中,所述目标客户端为所述当前消息的接收方。
第二方面,本公开提供一种消息发送装置,所述装置包括:
确定模块,用于确定在当前时间窗口内接收到的当前消息的消息类型,所述消息类型分为第一消息类型和第二消息类型;
缓存模块,用于若确定出的所述消息类型为所述第一消息类型,则将所述当前消息缓存到与所述当前消息对应的目标缓存队列中,其中,所述目标缓存队列中的各消息具有相关联的时间戳;
发送模块,用于若确定出的所述消息类型为所述第二消息类型,且在所述当前时间窗口内向目标客户端发送的消息总数未达到第一预设阈值,则将所述当前消息发送至所述目标客户端,其中,所述目标客户端为所述当前消息的接收方。
第三方面,本公开提供一种计算机可读介质,其上存储有计算机程序,该程序被处理器执行时实现第一方面中任一项所述方法的步骤。
第四方面,本公开提供一种电子设备,包括:
存储装置,其上存储有计算机程序;
处理装置,用于执行所述存储装置中的所述计算机程序,以实现第一方面中任一项所述方法的步骤。
在上述技术方案中,首先确定接收到的当前消息的消息类型。若当前消息为第一消息类型,则将其缓存在对应的目标缓存队列中;若当前消息为第二消息类型,则在当前时间窗口内发送的消息总数未达到第一预设阈值的情况下,将该当前消息发送至目标客户端。如此,通过控制发送至目标客户端的消息数量,可以有效避免网络拥塞现象,节约网络资源。并且,对于不同的消息类型,分别采用不同的消息处理方式,可以使得对于不同类型的消息的处理更有针对性。
本公开的其他特征和优点将在随后的具体实施方式部分予以详细 说明。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。在附图中:
图1是根据一示例性实施例示出的一种消息发送方法的流程图。
图2是根据另一示例性实施例示出的一种消息发送方法的流程图。
图3是根据一示例性实施例示出的一种消息发送装置的框图。
图4是根据一示例性实施例示出的一种电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应 该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
发明人在研究过程中发现,在控制发送至用户客户端的消息数量时,不同的消息类型对于实时性的要求不同,因此需要采用不同的消息发送方式。例如直播间中的聊天消息,对实时性的要求相对较低。而直播间中的排行榜消息,对实时性的要求相对较高,服务端在向用户客户端发送消息时,需要发送最新的消息,如此才可以保证用户通过该排行榜消息,获知的是最新的排名情况。
图1是根据一示例性实施例示出的一种消息发送方法的流程图。该方法可以应用于服务器,例如云服务器、消息管理服务器、直播平台等等。如图1所示,该消息发送方法可以包括:
在S11中,确定在当前时间窗口内接收到的当前消息的消息类型。
其中,一个时间窗口对应的预设时长可以预先设置,例如,该预设时长可以设置为1s。具体地,在当前这1s内,服务器接收到当前消息后,可以确定该当前消息的消息类型。其中,消息类型可以分为第一消息类型和第二消息类型。并且,属于第一消息类型的消息对实时性的要求相对较高,属于第二消息类型的消息对实时性的要求相对较低。
在一种实施方式中,该消息发送方法例如可以应用于直播平台。具体地,属于第一消息类型的消息可以包括以下中的至少一者:排行榜消息、点赞消息、表情消息等等;属于第二消息类型的消息可以包括以下中的至少一者:聊天消息、弹幕消息、送礼消息等等。
在S12中,若确定出的消息类型为第一消息类型,则将当前消息缓存到与该当前消息对应的目标缓存队列中。
其中,该目标缓存队列是与该当前消息对应的缓存队列,例如可以采用Redis(Remote Dictionary Server,远程数据服务)缓存队列进行存储。属于第一消息类型的消息都设置有各自对应的缓存队列。示例地,若当前消息为点赞消息,则可将该消息缓存到点赞消息对应的缓存队列中。若当前消息为排行榜消息,则可将该消息缓存到排行榜消息对应的缓存队列中。若当前消息为表情消息,则可将该消息缓存到表情消息对应的缓存队 列中。
并且,缓存在目标缓存队列中的各个消息都具有相关联的时间戳。其中,时间戳可以标识服务器接收到各个消息时的时间。例如,通过时间戳可以标识出在当前1s内,有消息是在第100ms接收到的,或有消息是在第500ms接收到的。利用时间戳还可以表征缓存队列中各个消息被接收到的顺序。通过将当前时间窗口内接收到的消息缓存到目标缓存队列中,可以进一步找到当前时间窗口内接收到的最新的消息。
在S13中,若确定出的消息类型为第二消息类型,且在当前时间窗口内向目标客户端发送的消息总数未达到第一预设阈值,则将当前消息发送至目标客户端。
其中,目标客户端可以为当前消息的接收方,例如观看直播的用户的客户端,该客户端例如可以为智能手机、笔记本电脑、台式电脑等等设备。由于目标客户端接收消息的能力是有限的,并且有些消息的重要性较低,不需要一定发送至目标客户端。如果给目标客户端发送过多的消息,不但造成资源浪费,还容易发生网络拥塞现象。因此,需要控制在一个时间窗口内,服务器向目标客户端发送的消息总数。具体地,第一预设阈值可以表示当前时间窗口内可以向目标客户端发送的消息数量的上限值。该第一预设阈值可以根据需要设置。例如可以根据属于第二消息类型的消息的优先级设置。其中,优先级高的消息对应的第一预设阈值高于优先级低的消息对应的第一预设阈值。
示例地,例如弹幕消息的优先级高于聊天消息的优先级,则弹幕消息对应的第一预设阈值高于聊天消息对应的第一预设阈值。例如在当前时间窗口内可以向目标客户端发送的弹幕消息的数量上限值设置为200个,可以发送的聊天消息的数量上限值设置为150个,可以发送的送礼消息的数量上限值设置为100个。示例地,如果当前消息为弹幕消息,并且在当前这1s内已经向目标客户端发送的弹幕消息总数为120个,未达到200个,则可以将该当前消息发送至目标客户端。在一种实施方式中,也可将聊天消息、弹幕消息以及送礼消息共同对应的上限值设置为450个,而对其各自的上限值不进行限制。
由于属于第二消息类型的消息(例如聊天消息)对实时性的要求较低, 并且,另外设置缓存队列占用系统存储空间。因此,对于属于第二消息类型的消息,不另外设置缓存队列,而是先到先发,对当前时间窗口内发送的消息数量进行计数,通过设置第一预设阈值来控制发送消息的数量。
在上述技术方案中,首先确定接收到的当前消息的消息类型。若当前消息为第一消息类型,则将其缓存在对应的目标缓存队列中;若当前消息为第二消息类型,则在当前时间窗口内发送的消息总数未达到第一预设阈值的情况下,将该当前消息发送至目标客户端。如此,通过控制发送至目标客户端的消息数量,可以有效避免网络拥塞现象,节约网络资源。并且,对于不同的消息类型,分别采用不同的消息处理方式,可以使得对于不同类型的消息的处理更有针对性。
图2是根据另一示例性实施例示出的一种消息发送方法的流程图。如图2所示,可选地,若确定出的消息类型为第一消息类型,则该方法还可以包括:
在S14中,在当前时间窗口结束时,将目标缓存队列中时间戳距离当前时间最近的N个消息发送至目标客户端。
例如,时间窗口的长度为1s,在当前时间窗口结束时,可将目标缓存队列中存储的这1s内接收到的消息,按照时间戳从晚至早排序,排名在前N个的消息即为距离当前时间最近的N个消息。服务器可将该N个消息发送至目标客户端。其中,N为正整数,并且,N的最大值为第二预设阈值。具体地,该第二预设阈值可以根据实际需要进行设置,例如对于排行榜消息,该第二预设阈值可以设置为100个。对于表情消息,该第二预设阈值可以设置为120个。对于点赞消息,该第二预设阈值可以设置为150个。
通过上述技术方案,若当前消息为第一消息类型,可以使得发送至目标客户端的是距离当前时间最近的消息,保证目标客户端接收到的消息是最新的消息。例如对于排行榜消息,可以使得用户了解到的是最新的排名情况,保证了发送的消息的实时性。同时,N的最大值可以为设置的第二预设阈值,可以有效控制发送至目标客户端的消息数量,从而有效避免网络拥塞现象。
可选地,如图2所示,在将N个消息发送至目标客户端之后,该方 法还可以包括:
在S15中,从目标缓存队列中移除该N个消息。
其中,在当前时间窗口结束后,目标缓存队列需要接收下一个时间窗口的消息,因此,在将N个消息发送至目标客户端后,需要从目标缓存队列中移除该N个消息,以便于该目标缓存队列能够及时接收到下一个时间窗口的消息,从而保证下一个时间窗口的消息的正常处理和发送。示例地,可以通过设置定时自动清除的方式以移除该N个消息,例如每一个时间窗口(如,1s)清除一次缓存队列中消息。
可选地,S14可以包括:
将目标缓存队列中的消息同步到内存中;
在内存中,将时间戳距离当前时间最近的N个消息发送至目标客户端。
其中,由于缓存的存储容量小,且处理能力有限,如果在缓存中处理大量的消息,可能会影响其正常运行。因此,可将目标缓存队列中的消息同步到内存中,该内存例如可以为消息管理服务器的系统内存。具体地,可通过中间服务层将消息从缓存队列同步到系统内存中,该中间服务层处于缓存与系统内存之间,可以起到消息同步与转发的作用。由于系统内存的存储空间较大,并且可以根据需要进行扩容操作,因此,能够满足数据量较大时对消息的处理操作。
具体地,在内存中,将时间戳距离当前时间最近的N个消息发送至目标客户端。如上文所述,例如可将当前时间窗口内接收到的消息根据时间戳进行排序,进而确定距离当前时间最近的N个消息,并且,N为正整数,N的最大值为第二预设阈值。
在上述技术方案中,通过将目标缓存队列中的消息同步到内存中,并在内存中确定距离当前时间最近的N个消息,可以避免缓存的存储空间较小而影响消息处理效率的问题,在内存中对消息进行处理,可以提高消息处理速度和效率。
可选地,如图2所示,该方法还可以包括:
在S16中,若确定出的消息类型为第二消息类型,且在当前时间窗口内向目标客户端发送的消息总数已达到第一预设阈值,则可以丢弃该 当前消息。
其中,如上文所述,目标客户端的接收能力以及网络的传输能力均有限,如果发送过多的消息容易导致网络拥塞以及网络延迟现象。因此,如果在当前时间窗口内向目标客户端发送的消息总数已达到第一预设阈值,则服务器可以丢弃该当前消息,不对该当前消息进行存储或处理。
如此,可以节约服务器的存储资源,并且,还可以有效控制发送至目标客户端的消息数量,从而节约网络资源,避免网络拥塞现象。
基于同一发明构思,本公开还提供一种消息发送装置。图3是根据一示例性实施例示出的一种消息发送装置的框图。如图3所示,该装置300可以包括:
确定模块301,用于确定在当前时间窗口内接收到的当前消息的消息类型,所述消息类型分为第一消息类型和第二消息类型;
缓存模块302,用于若确定出的所述消息类型为所述第一消息类型,则将所述当前消息缓存到与所述当前消息对应的目标缓存队列中,其中,所述目标缓存队列中的各消息具有相关联的时间戳;
发送模块303,用于若确定出的所述消息类型为所述第二消息类型,且在所述当前时间窗口内向目标客户端发送的消息总数未达到第一预设阈值,则将所述当前消息发送至所述目标客户端,其中,所述目标客户端为所述当前消息的接收方。
在上述技术方案中,首先确定接收到的当前消息的消息类型。若当前消息为第一消息类型,则将其缓存在对应的目标缓存队列中;若当前消息为第二消息类型,则在当前时间窗口内发送的消息总数未达到第一预设阈值的情况下,将该当前消息发送至目标客户端。如此,通过控制发送至目标客户端的消息数量,可以有效避免网络拥塞现象,节约网络资源。并且,对于不同的消息类型,分别采用不同的消息处理方式,可以使得对于不同类型的消息的处理更有针对性。
可选地,所述发送模块303还用于若确定出的所述消息类型为所述第一消息类型,则在所述当前时间窗口结束时,将所述目标缓存队列中时间戳距离当前时间最近的N个消息发送至所述目标客户端,其中,N为正整数,且N的最大值为第二预设阈值。
可选地,所述装置300还可以包括:
移除模块,用于在将所述N个消息发送至所述目标客户端之后,从所述目标缓存队列中移除所述N个消息。
可选地,所述发送模块303可以包括:
同步子模块,用于将所述目标缓存队列中的消息同步到内存中;
发送子模块,用于在所述内存中,将时间戳距离当前时间最近的N个消息发送至所述目标客户端。
可选地,所述装置300还可以包括:
丢弃模块,用于若确定出的所述消息类型为所述第二消息类型,且在所述当前时间窗口内向所述目标客户端发送的消息总数已达到所述第一预设阈值,则丢弃所述当前消息。
下面参考图4,其示出了适于用来实现本公开实施例的电子设备400的结构示意图。图4示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图4所示,电子设备400可以包括处理装置(例如中央处理器、图形处理器等)401,其可以根据存储在只读存储器(ROM)402中的程序或者从存储装置408加载到随机访问存储器(RAM)403中的程序而执行各种适当的动作和处理。在RAM 403中,还存储有电子设备400操作所需的各种程序和数据。处理装置401、ROM 402以及RAM 403通过总线404彼此相连。输入/输出(I/O)接口405也连接至总线404。
通常,以下装置可以连接至I/O接口405:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置406;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置407;包括例如磁带、硬盘等的存储装置408;以及通信装置409。通信装置409可以允许电子设备400与其他设备进行无线或有线通信以交换数据。虽然图4示出了具有各种装置的电子设备400,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包 含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置409从网络上被下载和安装,或者从存储装置408被安装,或者从ROM 402被安装。在该计算机程序被处理装置401执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:
确定在当前时间窗口内接收到的当前消息的消息类型,所述消息类型分为第一消息类型和第二消息类型;
若确定出的所述消息类型为所述第一消息类型,则将所述当前消息缓存到与所述当前消息对应的目标缓存队列中,其中,所述目标缓存队列中的各消息具有相关联的时间戳;
若确定出的所述消息类型为所述第二消息类型,且在所述当前时间窗口内向目标客户端发送的消息总数未达到第一预设阈值,则将所述当前消息发送至所述目标客户端,其中,所述目标客户端为所述当前消息的接收方。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言——诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的 专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,模块的名称在某种情况下并不构成对该模块本身的限定,例如,确定模块还可以被描述为“确定单元”等等。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,示例1提供了一种消息发送方法,所述方法包括:确定在当前时间窗口内接收到的当前消息的消息类型,所述消息类型分为第一消息类型和第二消息类型;若确定出的所述消息类型为所述第一消息类型,则将所述当前消息缓存到与所述当前消息对应的目标缓存队列中,其中,所述目标缓存队列中的各消息具有相关联的时间戳;若确定出的所述消息类型为所述第二消息类型,且在所述当前时间窗口内向目标客户端发送的消息总数未达到第一预设阈值,则将所述当前消息发送至所述目标客户端,其中,所述目标客户端为所述当前消息的接收方。
根据本公开的一个或多个实施例,示例2提供了示例1的方法,若确定出的所述消息类型为所述第一消息类型,则所述方法还包括:
在所述当前时间窗口结束时,将所述目标缓存队列中时间戳距离当前时间最近的N个消息发送至所述目标客户端,其中,N为正整数,且N的最大值为第二预设阈值。
根据本公开的一个或多个实施例,示例3提供了示例2的方法,在将所述N个消息发送至所述目标客户端之后,还包括:从所述目标缓存队列中移除所述N个消息。
根据本公开的一个或多个实施例,示例4提供了示例2的方法,所述将所述目标缓存队列中时间戳距离当前时间最近的N个消息发送至所述目标客户端,包括:将所述目标缓存队列中的消息同步到内存中;在所述内存中,将时间戳距离当前时间最近的N个消息发送至所述目标客户端。
根据本公开的一个或多个实施例,示例5提供了示例1的方法,若确定出的所述消息类型为所述第二消息类型,则所述方法还包括:若在所述当前时间窗口内向所述目标客户端发送的消息总数已达到所述第一预设阈值,则丢弃所述当前消息。
根据本公开的一个或多个实施例,示例6提供了示例1至示例5中任一示例的方法,所述方法应用于直播平台,属于第一消息类型的消息包括以下中的至少一者:排行榜消息、点赞消息、表情消息;属于第二消息类型的消息包括以下中的至少一者:聊天消息、弹幕消息、送礼消息。
根据本公开的一个或多个实施例,示例7提供了示例6的方法,所述第一预设阈值根据所述属于第二消息类型的消息的优先级设置,其中,所述优先级高的消息对应的所述第一预设阈值高于所述优先级低的消息对应的所述第一预设阈值。
根据本公开的一个或多个实施例,示例8提供了一种消息发送装置,所述装置包括:确定模块,用于确定在当前时间窗口内接收到的当前消息的消息类型,所述消息类型分为第一消息类型和第二消息类型;缓存模块,用于若确定出的所述消息类型为所述第一消息类型,则将所述当前消息缓存到与所述当前消息对应的目标缓存队列中,其中,所述目标缓存队列中的各消息具有相关联的时间戳;发送模块,用于若确定出的所述消息类型为所述第二消息类型,且在所述当前时间窗口内向目标客户端发送的 消息总数未达到第一预设阈值,则将所述当前消息发送至所述目标客户端,其中,所述目标客户端为所述当前消息的接收方。
根据本公开的一个或多个实施例,示例9提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现示例1至示例7中任一项所述方法的步骤。
根据本公开的一个或多个实施例,示例10提供了一种电子设备,包括:存储装置,其上存储有计算机程序;处理装置,用于执行所述存储装置中的所述计算机程序,以实现示例1至示例7中任一项所述方法的步骤。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。

Claims (10)

  1. 一种消息发送方法,其特征在于,所述方法包括:
    确定在当前时间窗口内接收到的当前消息的消息类型,所述消息类型分为第一消息类型和第二消息类型;
    若确定出的所述消息类型为所述第一消息类型,则将所述当前消息缓存到与所述当前消息对应的目标缓存队列中,其中,所述目标缓存队列中的各消息具有相关联的时间戳;
    若确定出的所述消息类型为所述第二消息类型,且在所述当前时间窗口内向目标客户端发送的消息总数未达到第一预设阈值,则将所述当前消息发送至所述目标客户端,其中,所述目标客户端为所述当前消息的接收方。
  2. 根据权利要求1所述的方法,其特征在于,若确定出的所述消息类型为所述第一消息类型,则所述方法还包括:
    在所述当前时间窗口结束时,将所述目标缓存队列中时间戳距离当前时间最近的N个消息发送至所述目标客户端,其中,N为正整数,且N的最大值为第二预设阈值。
  3. 根据权利要求2所述的方法,其特征在于,在将所述N个消息发送至所述目标客户端之后,还包括:从所述目标缓存队列中移除所述N个消息。
  4. 根据权利要求2所述的方法,其特征在于,所述将所述目标缓存队列中时间戳距离当前时间最近的N个消息发送至所述目标客户端,包括:
    将所述目标缓存队列中的消息同步到内存中;
    在所述内存中,将时间戳距离当前时间最近的N个消息发送至所述目标客户端。
  5. 根据权利要求1所述的方法,其特征在于,若确定出的所述消 息类型为所述第二消息类型,则所述方法还包括:
    若在所述当前时间窗口内向所述目标客户端发送的消息总数已达到所述第一预设阈值,则丢弃所述当前消息。
  6. 根据权利要求1-5中任一项所述的方法,其特征在于,所述方法应用于直播平台,属于第一消息类型的消息包括以下中的至少一者:排行榜消息、点赞消息、表情消息;属于第二消息类型的消息包括以下中的至少一者:聊天消息、弹幕消息、送礼消息。
  7. 根据权利要求6所述的方法,其特征在于,所述第一预设阈值根据所述属于第二消息类型的消息的优先级设置,其中,所述优先级高的消息对应的所述第一预设阈值高于所述优先级低的消息对应的所述第一预设阈值。
  8. 一种消息发送装置,其特征在于,所述装置包括:
    确定模块,用于确定在当前时间窗口内接收到的当前消息的消息类型,所述消息类型分为第一消息类型和第二消息类型;
    缓存模块,用于若确定出的所述消息类型为所述第一消息类型,则将所述当前消息缓存到与所述当前消息对应的目标缓存队列中,其中,所述目标缓存队列中的各消息具有相关联的时间戳;
    发送模块,用于若确定出的所述消息类型为所述第二消息类型,且在所述当前时间窗口内向目标客户端发送的消息总数未达到第一预设阈值,则将所述当前消息发送至所述目标客户端,其中,所述目标客户端为所述当前消息的接收方。
  9. 一种计算机可读介质,其上存储有计算机程序,其特征在于,该程序被处理装置执行时实现权利要求1-7中任一项所述方法的步骤。
  10. 一种电子设备,其特征在于,包括:
    存储装置,其上存储有计算机程序;
    处理装置,用于执行所述存储装置中的所述计算机程序,以实现权利要求1-7中任一项所述方法的步骤。
PCT/CN2020/110041 2019-10-16 2020-08-19 消息发送方法、装置、可读介质及电子设备 Ceased WO2021073248A1 (zh)

Priority Applications (5)

Application Number Priority Date Filing Date Title
JP2022522866A JP7454662B2 (ja) 2019-10-16 2020-08-19 情報送信方法、装置、読み取り可能な記憶媒体及び電子装置
KR1020227012470A KR102725987B1 (ko) 2019-10-16 2020-08-19 정보 송신 방법, 장치, 판독 가능한 매체 및 전자 장치
EP20877202.0A EP4047934B1 (en) 2019-10-16 2020-08-19 Message sending method and device, readable medium and electronic device
BR112022007289A BR112022007289A2 (pt) 2019-10-16 2020-08-19 Método e dispositivo de envio de mensagem, mídia legível e dispositivo eletrônico
US17/769,739 US12075106B2 (en) 2019-10-16 2020-08-19 Message sending method and device, readable medium and electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910985122.3A CN110662085B (zh) 2019-10-16 2019-10-16 消息发送方法、装置、可读介质及电子设备
CN201910985122.3 2019-10-16

Publications (1)

Publication Number Publication Date
WO2021073248A1 true WO2021073248A1 (zh) 2021-04-22

Family

ID=69041203

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/110041 Ceased WO2021073248A1 (zh) 2019-10-16 2020-08-19 消息发送方法、装置、可读介质及电子设备

Country Status (7)

Country Link
US (1) US12075106B2 (zh)
EP (1) EP4047934B1 (zh)
JP (1) JP7454662B2 (zh)
KR (1) KR102725987B1 (zh)
CN (1) CN110662085B (zh)
BR (1) BR112022007289A2 (zh)
WO (1) WO2021073248A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114040254A (zh) * 2021-11-08 2022-02-11 聚好看科技股份有限公司 一种显示设备及高并发消息显示方法
CN114945003A (zh) * 2022-05-31 2022-08-26 济南浪潮数据技术有限公司 一种避免消息阻塞网络的控制方法、装置、设备及介质
CN115379281A (zh) * 2021-05-20 2022-11-22 北京字节跳动网络技术有限公司 虚拟直播间的消息展示方法、装置和设备
CN115706939A (zh) * 2021-08-17 2023-02-17 中国移动通信有限公司研究院 行业消息的发送方法及装置
CN115904898A (zh) * 2022-10-27 2023-04-04 上海思岚科技有限公司 用于性能消耗指标的分析方法与设备
WO2024179361A1 (zh) * 2023-02-28 2024-09-06 北京字跳网络技术有限公司 一种消息处理方法、装置、设备及介质
CN119582972A (zh) * 2025-02-05 2025-03-07 中国船舶集团有限公司第七〇七研究所 基于水声通信的授时方法、装置、电子设备和存储介质

Families Citing this family (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110662085B (zh) 2019-10-16 2021-10-01 北京字节跳动网络技术有限公司 消息发送方法、装置、可读介质及电子设备
CN113709020B (zh) * 2020-05-20 2024-02-06 腾讯科技(深圳)有限公司 消息发送方法、消息接收方法、装置、设备及介质
CN111901619B (zh) * 2020-07-23 2023-10-31 北京达佳互联信息技术有限公司 一种消息推送方法和装置
CN112100556B (zh) * 2020-08-25 2023-02-24 福建天泉教育科技有限公司 优化消息推送方式的方法及其系统
US11115363B1 (en) * 2020-09-02 2021-09-07 Whatsapp Llc Utilizing encrypted ephemeral messages to modify ephemeral message duration settings
CN112199174B (zh) * 2020-09-30 2025-07-08 北京字节跳动网络技术有限公司 消息发送的控制方法、装置、电子设备及计算机可读存储介质
CN114727255A (zh) * 2020-12-19 2022-07-08 北京万集科技股份有限公司 消息处理方法、装置、计算机设备和存储介质
CN112702259B (zh) * 2020-12-23 2023-05-23 北京焦点新干线信息技术有限公司 延迟消息推送方法、装置及消息中间件
CN114740738B (zh) * 2021-01-07 2025-10-24 深圳爱根斯通科技有限公司 数据处理方法、装置、控制端及存储介质
CN114816783B (zh) * 2021-01-29 2025-02-25 北京字节跳动网络技术有限公司 消息发送方法、装置、电子设备及计算机可读存储介质
CN115209166A (zh) * 2021-04-12 2022-10-18 北京字节跳动网络技术有限公司 一种消息发送方法、装置、设备和存储介质
CN113094002B (zh) * 2021-05-12 2023-07-18 抖音视界有限公司 消息处理方法、装置、电子设备和计算机介质
CN113138883B (zh) * 2021-05-14 2024-02-02 北京字节跳动网络技术有限公司 消息处理方法、装置、存储介质及电子设备
US12586125B2 (en) * 2021-05-28 2026-03-24 Whatnot, Inc. Method and system for reduced latency in a scalable, multi-user, publish-subscribe architecture
CN113645508B (zh) * 2021-08-10 2023-09-19 北京读我科技有限公司 一种消息输出方法、装置及系统
CN113810759B (zh) * 2021-09-15 2024-03-01 上海哔哩哔哩科技有限公司 视频点赞实现方法及装置
CN114124881B (zh) * 2021-11-30 2023-06-20 中国建设银行股份有限公司 一种基于优先级的消息推送方法及相关装置
CN114590656B (zh) * 2022-01-30 2024-03-26 云知声智能科技股份有限公司 电梯控制方法、装置、电子设备和存储介质
CN115080468B (zh) * 2022-05-12 2024-06-14 珠海全志科技股份有限公司 一种非阻塞的信息传输方法和装置
CN117640516A (zh) * 2022-08-09 2024-03-01 抖音视界有限公司 消息处理方法、装置、电子设备和存储介质
CN115794446B (zh) * 2023-01-18 2023-05-09 苏州浪潮智能科技有限公司 一种消息处理方法、装置、电子设备和存储介质
CN117076138B (zh) * 2023-10-17 2024-02-23 西安羚控电子科技有限公司 面向体系仿真的资源跨平台集成和调度方法及装置
CN117560417B (zh) * 2023-11-20 2024-05-17 上海万雍科技股份有限公司 针对消息发送的队列控制方法、装置、电子设备与介质
CN119211155B (zh) * 2024-10-12 2025-10-10 新华三技术有限公司 一种报文传输方法、装置、电子设备及存储介质
CN119766593A (zh) * 2025-03-06 2025-04-04 北京中科海芯科技有限公司 Can总线控制器、消息缓存方法和电子设备
CN120416782B (zh) * 2025-03-20 2026-04-03 深圳市微网信云科技有限公司 多用户多通道的消息调度方法、装置、设备及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5530474B2 (ja) * 2012-03-22 2014-06-25 ヤフー株式会社 情報処理装置及び方法
JP2016132664A (ja) * 2015-01-15 2016-07-25 株式会社クレンシアコスメ L‐アスコルビン酸配合凍結乾燥化粧料
CN105979343A (zh) * 2016-06-28 2016-09-28 武汉斗鱼网络科技有限公司 一种基于网页弹幕弹幕层级设置的方法及装置
CN106028163A (zh) * 2016-05-19 2016-10-12 乐视控股(北京)有限公司 客户端的弹幕显示方法及装置
CN108495166A (zh) * 2018-01-29 2018-09-04 上海哔哩哔哩科技有限公司 弹幕播放控制方法、终端及弹幕播放控制系统
CN109274988A (zh) * 2018-08-20 2019-01-25 武汉斗鱼网络科技有限公司 弹幕消息分发方法、装置、设备及存储介质
CN110662085A (zh) * 2019-10-16 2020-01-07 北京字节跳动网络技术有限公司 消息发送方法、装置、可读介质及电子设备

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7865684B2 (en) * 2005-06-27 2011-01-04 Ab Initio Technology Llc Managing message queues
JP2009089019A (ja) 2007-09-28 2009-04-23 Fujitsu Ltd マルチキャスト配信制御装置、コンピュータプログラム、マルチキャスト配信制御システム及びマルチキャスト配信制御方法
JP4687758B2 (ja) 2008-08-08 2011-05-25 株式会社日立製作所 輻輳制御方法
US10785174B2 (en) * 2013-11-15 2020-09-22 Google Llc Messaging for event live-stream
US9641989B1 (en) * 2014-09-24 2017-05-02 Amazon Technologies, Inc. Displaying messages according to priority
US20160307286A1 (en) 2015-04-15 2016-10-20 Athoc, Inc. Safety Communication Hub for Organizations
CN105391785A (zh) * 2015-11-25 2016-03-09 广州华多网络科技有限公司 一种业务消息的处理方法和服务器
US9935888B2 (en) * 2016-05-02 2018-04-03 Visa International Service Association System and method for latency-based queuing
US9667681B1 (en) 2016-09-23 2017-05-30 Machine Zone, Inc. Systems and methods for providing messages to multiple subscribers
CN106507133B (zh) 2016-11-28 2019-07-26 北京金山安全软件有限公司 弹幕消息的处理方法、装置、系统及其设备
CN108174305B (zh) * 2016-12-07 2019-03-12 北京云中融信网络科技有限公司 直播聊天室的消息处理方法及装置
US10425378B2 (en) 2016-12-19 2019-09-24 Facebook, Inc. Comment synchronization in a video stream
CN107231294A (zh) * 2017-05-24 2017-10-03 北京潘达互娱科技有限公司 消息处理方法及装置
CN107666619B (zh) * 2017-06-15 2019-11-08 北京金山云网络技术有限公司 直播数据传输方法、装置、电子设备、服务器及存储介质
CN110138679B (zh) * 2019-04-03 2022-09-20 北京旷视科技有限公司 数据流调度方法及装置

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5530474B2 (ja) * 2012-03-22 2014-06-25 ヤフー株式会社 情報処理装置及び方法
JP2016132664A (ja) * 2015-01-15 2016-07-25 株式会社クレンシアコスメ L‐アスコルビン酸配合凍結乾燥化粧料
CN106028163A (zh) * 2016-05-19 2016-10-12 乐视控股(北京)有限公司 客户端的弹幕显示方法及装置
CN105979343A (zh) * 2016-06-28 2016-09-28 武汉斗鱼网络科技有限公司 一种基于网页弹幕弹幕层级设置的方法及装置
CN108495166A (zh) * 2018-01-29 2018-09-04 上海哔哩哔哩科技有限公司 弹幕播放控制方法、终端及弹幕播放控制系统
CN109274988A (zh) * 2018-08-20 2019-01-25 武汉斗鱼网络科技有限公司 弹幕消息分发方法、装置、设备及存储介质
CN110662085A (zh) * 2019-10-16 2020-01-07 北京字节跳动网络技术有限公司 消息发送方法、装置、可读介质及电子设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4047934A4 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115379281A (zh) * 2021-05-20 2022-11-22 北京字节跳动网络技术有限公司 虚拟直播间的消息展示方法、装置和设备
CN115706939A (zh) * 2021-08-17 2023-02-17 中国移动通信有限公司研究院 行业消息的发送方法及装置
CN114040254A (zh) * 2021-11-08 2022-02-11 聚好看科技股份有限公司 一种显示设备及高并发消息显示方法
WO2023077991A1 (zh) * 2021-11-08 2023-05-11 聚好看科技股份有限公司 显示设备及其显示方法
CN114945003A (zh) * 2022-05-31 2022-08-26 济南浪潮数据技术有限公司 一种避免消息阻塞网络的控制方法、装置、设备及介质
CN114945003B (zh) * 2022-05-31 2024-02-13 济南浪潮数据技术有限公司 一种避免消息阻塞网络的控制方法、装置、设备及介质
CN115904898A (zh) * 2022-10-27 2023-04-04 上海思岚科技有限公司 用于性能消耗指标的分析方法与设备
WO2024179361A1 (zh) * 2023-02-28 2024-09-06 北京字跳网络技术有限公司 一种消息处理方法、装置、设备及介质
CN119582972A (zh) * 2025-02-05 2025-03-07 中国船舶集团有限公司第七〇七研究所 基于水声通信的授时方法、装置、电子设备和存储介质

Also Published As

Publication number Publication date
CN110662085B (zh) 2021-10-01
JP7454662B2 (ja) 2024-03-22
CN110662085A (zh) 2020-01-07
EP4047934B1 (en) 2025-10-01
KR20220062101A (ko) 2022-05-13
US20220394316A1 (en) 2022-12-08
KR102725987B1 (ko) 2024-11-05
JP2022552986A (ja) 2022-12-21
US12075106B2 (en) 2024-08-27
EP4047934A1 (en) 2022-08-24
BR112022007289A2 (pt) 2022-07-05
EP4047934A4 (en) 2023-12-27

Similar Documents

Publication Publication Date Title
WO2021073248A1 (zh) 消息发送方法、装置、可读介质及电子设备
US9621465B2 (en) Wired data-connection aggregation
EP2933963B1 (en) Traffic flow control based on the traffic type
CN112199174B (zh) 消息发送的控制方法、装置、电子设备及计算机可读存储介质
CN111314439A (zh) 一种数据发送方法、装置和电子设备
CN102480430A (zh) 实现报文保序的方法和装置
CN106411778B (zh) 数据转发的方法及装置
WO2023217188A1 (zh) 一种直播数据传输方法、装置、系统、设备和介质
CN112015816A (zh) 数据同步方法、装置、介质及电子设备
CN114390451A (zh) 基于消息队列的5g消息批量发送方法、装置及电子设备
CN113364767A (zh) 一种流媒体数据显示方法、装置、电子设备及存储介质
CN112527782A (zh) 一种数据处理的方法和装置
CN113037853A (zh) 数据处理方法、装置、设备及存储介质
CN102281183A (zh) 处理网络拥塞的方法、装置和核心网络实体
CN114257870B (zh) 短视频播放方法、装置、设备及存储介质
CN112163176B (zh) 数据存储方法、装置、电子设备和计算机可读介质
CN112653691B (zh) 一种数据处理方法、装置、设备及存储介质
WO2016065779A1 (zh) 队列的调度方法及装置
CN112632434B (zh) 信息发送方法、装置、电子设备和计算机可读介质
US9674282B2 (en) Synchronizing SLM statuses of a plurality of appliances in a cluster
CN104396195A (zh) 一种数据包传输方法及设备
CN112182002A (zh) 数据容灾方法、装置、电子设备和计算机可读介质
CN108243091B (zh) 一种信息共享装置和信息共享方法
CN112040328A (zh) 数据交互方法、装置和电子设备
CN110049068A (zh) 一种基于超文本传输协议的网络长连接优化的方法和装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20877202

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 20227012470

Country of ref document: KR

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 2022522866

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

REG Reference to national code

Ref country code: BR

Ref legal event code: B01A

Ref document number: 112022007289

Country of ref document: BR

ENP Entry into the national phase

Ref document number: 2020877202

Country of ref document: EP

Effective date: 20220516

ENP Entry into the national phase

Ref document number: 112022007289

Country of ref document: BR

Kind code of ref document: A2

Effective date: 20220414

WWG Wipo information: grant in national office

Ref document number: 2020877202

Country of ref document: EP

WWG Wipo information: grant in national office

Ref document number: 202227028089

Country of ref document: IN