Movatterモバイル変換


[0]ホーム

URL:


CN111726280A - An instant message transmission method, device, electronic device and storage medium - Google Patents

An instant message transmission method, device, electronic device and storage medium
Download PDF

Info

Publication number
CN111726280A
CN111726280ACN202010497880.3ACN202010497880ACN111726280ACN 111726280 ACN111726280 ACN 111726280ACN 202010497880 ACN202010497880 ACN 202010497880ACN 111726280 ACN111726280 ACN 111726280A
Authority
CN
China
Prior art keywords
message
data center
instant message
instant
broadcast
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010497880.3A
Other languages
Chinese (zh)
Inventor
王贵喜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuomi Private Ltd
Original Assignee
Hong Kong LiveMe Corp 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 Hong Kong LiveMe Corp ltdfiledCriticalHong Kong LiveMe Corp ltd
Priority to CN202010497880.3ApriorityCriticalpatent/CN111726280A/en
Publication of CN111726280ApublicationCriticalpatent/CN111726280A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

The embodiment of the invention discloses a method and a device for transmitting instant messages, electronic equipment and a storage medium, relates to the technical field of Internet, and can effectively improve the transmission efficiency and reliability of instant messages. The method comprises the following steps: receiving an instant message, wherein the instant message carries an object identifier of a receiving object of the instant message, and a sender of the instant message is positioned in a service range of a first data center; and if the receiving object of the instant message is positioned in the service range of a second data center, storing the instant message into a first message queue server of the first data center so that the second data center reads the instant message from the first message queue server and forwards the instant message to the receiving object, wherein the first data center is different from the second data center. The invention can be used in instant message transmission.

Description

Translated fromChinese
一种即时消息的传输方法、装置、电子设备及存储介质An instant message transmission method, device, electronic device and storage medium

技术领域technical field

本发明涉及互联网技术领域,尤其涉及一种即时消息的传输方法、装置、电子设备及存储介质。The present invention relates to the field of Internet technologies, and in particular, to a method, device, electronic device and storage medium for transmitting instant messages.

背景技术Background technique

随着微信和直播等应用的兴起,即时消息成为用户之间重要的联络和交流方式。在即使消息通讯中,不同用户之间可以通过数据中心进行信息转发。With the rise of applications such as WeChat and live streaming, instant messaging has become an important means of contact and communication between users. In instant messaging, information can be forwarded between different users through the data center.

根据业务需求的不同,即时消息的转发可以基于一个数据中心或多个数据中心。其中,多个数据中心可以按照地理位置分布,例如欧洲数据中心、北美中心等,从而使处于不同地理位置的用户可以接入就近的数据中心,获得较佳的网络服务。According to different business needs, the forwarding of instant messages can be based on one data center or multiple data centers. Among them, multiple data centers can be distributed according to geographical locations, such as European data centers, North American centers, etc., so that users in different geographical locations can access the nearest data centers and obtain better network services.

然而,当进行即使消息通信的用户属于不同数据中心的情况下,这些数据中心之间就需要进行消息同步。目前,数据中心之间大都采用基于HTTP(hyper text transferprotocol,超文本传输协议)或者RPC(remote procedure call,远过程调用)的服务传输方式。其中,HTTP方式传输速度慢,而RPC方式在遇到网络抖动时,会丢消息,可靠性差。However, when the users who perform message communication belong to different data centers, message synchronization needs to be performed between these data centers. At present, most of the data centers use a service transmission method based on HTTP (hyper text transfer protocol, hypertext transfer protocol) or RPC (remote procedure call, remote procedure call). Among them, the HTTP method has a slow transmission speed, and the RPC method will lose messages when it encounters network jitter, and the reliability is poor.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明实施例提供一种即时消息的传输方法、装置、电子设备及存储介质,能够有效提高即时消息的传输效率和可靠性。In view of this, embodiments of the present invention provide an instant message transmission method, device, electronic device, and storage medium, which can effectively improve the transmission efficiency and reliability of instant messages.

第一方面,本发明实施例提供一种即时消息的传输方法,包括:接收即时消息,所述即时消息携带所述即时消息的接收对象的对象标识,所述即时消息的发出者位于第一数据中心的服务范围内;若所述即时消息的接收对象位于第二数据中心的服务范围内,则将所述即时消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述即时消息并转发给所述接收对象,其中,所述第一数据中心与所述第二数据中心不同。In a first aspect, an embodiment of the present invention provides an instant message transmission method, including: receiving an instant message, wherein the instant message carries an object identifier of a recipient of the instant message, and the sender of the instant message is located in a first data If the recipient of the instant message is within the service scope of the second data center, the instant message will be stored in the first message queue server of the first data center, so that the A second data center reads the instant message from the first message queue server and forwards it to the recipient, wherein the first data center is different from the second data center.

可选的,所述若所述即时消息的接收对象位于第二数据中心的服务范围内,则将所述即时消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述即时消息并转发给所述接收对象包括:若所述即时消息的接收对象处于第二数据中心的服务范围内,且所述即时消息的接收对象为群或直播间,则根据所述即时消息生成广播消息;将所述广播消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述广播消息并向所述第二数据中心的服务范围内的所有长连接服务器广播所述广播消息。Optionally, if the recipient of the instant message is located within the service range of the second data center, the instant message is stored in the first message queue server of the first data center, so that the The second data center reads the instant message from the first message queue server and forwards it to the recipient, including: if the recipient of the instant message is within the service range of the second data center, and the instant message is If the receiving object is a group or a live broadcast room, a broadcast message is generated according to the instant message; A message queue server reads the broadcast message and broadcasts the broadcast message to all persistent connection servers within the service range of the second data center.

可选的,所述若所述即时消息的接收对象位于第二数据中心的服务范围内,则将所述即时消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述即时消息并转发给所述接收对象包括:若所述即时消息的接收对象处于第二数据中心的服务范围内,且所述即时消息的接收对象为群或直播间,则查找所述即时消息的接收对象中的各成员所连接的目标长连接服务器,所述目标长连接服务器位于所述第二数据中心的服务范围内;根据所述即时消息生成广播消息,所述广播消息携带所述目标长连接服务器的身份标识;将所述广播消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述广播消息,并向所述目标长连接服务器的身份标识对应的所述长连接服务器广播所述广播消息。Optionally, if the recipient of the instant message is located within the service range of the second data center, the instant message is stored in the first message queue server of the first data center, so that the The second data center reads the instant message from the first message queue server and forwards it to the recipient, including: if the recipient of the instant message is within the service range of the second data center, and the instant message is If the receiving object is a group or a live room, search for the target persistent connection server to which each member in the receiving object of the instant message is connected, and the target persistent connection server is located within the service range of the second data center; according to the The instant message generates a broadcast message, and the broadcast message carries the identity of the target persistent connection server; the broadcast message is stored in the first message queue server of the first data center, so that the second data center can be The first message queue server reads the broadcast message, and broadcasts the broadcast message to the persistent connection server corresponding to the identity of the target persistent connection server.

可选的,在所述将所述即时消息存入所述第一数据中心的第一消息队列服务器之前,所述方法还包括:根据所述接收对象的对象标识,确定所述接收对象所在的数据中心,其中,所述接收对象包括以下任一项:单聊用户、群、直播间,所述群的成员或所述直播间的成员所在的数据中心为一个或多个。Optionally, before the instant message is stored in the first message queue server of the first data center, the method further includes: determining the location where the receiving object is located according to the object identifier of the receiving object. A data center, wherein the receiving object includes any one of the following: a single chat user, a group, and a live broadcast room, and there are one or more data centers where members of the group or members of the live broadcast room are located.

可选的,在所述将所述即时消息存入所述第一数据中心的第一消息队列服务器之后,所述方法还包括:维护所述即时消息,并在所述第二数据中心从所述第一消息队列服务器读取所述即时消息后,将所述即时消息从所述第一消息队列服务器中删除。Optionally, after the instant message is stored in the first message queue server of the first data center, the method further includes: maintaining the instant message, and storing the instant message in the second data center from the first message queue server. After the first message queue server reads the instant message, the instant message is deleted from the first message queue server.

第二方面,本发明的实施例还提供一种即时消息的传输方法,包括:从第一数据中心的第一消息队列服务器中获取更新的即时消息,所述即时消息携带所述即时消息的接收对象的对象标识,所述接收对象位于第二数据中心的服务范围内,所述第一数据中心与所述第二数据中心不同;根据所述对象标识,将所述即时消息转发给所述接收对象。In a second aspect, an embodiment of the present invention further provides an instant message transmission method, comprising: acquiring an updated instant message from a first message queue server in a first data center, where the instant message carries the received instant message The object identifier of the object, the receiving object is located in the service range of the second data center, and the first data center is different from the second data center; according to the object identifier, the instant message is forwarded to the receiving object.

可选的,所述根据所述对象标识,将所述即时消息转发给所述接收对象包括:若所述即时消息为广播消息,则向所述第二数据中心的服务范围内的所有长连接服务器广播所述广播消息;各所述长连接服务器根据所述广播消息,确定本长连接服务器中是否存在所述对象标识对应的群中或直播间中的成员;若本长连接服务器中存在所述对象标识对应的群中或直播间中的成员,则向每个所述成员转发所述广播消息。Optionally, forwarding the instant message to the receiving object according to the object identifier includes: if the instant message is a broadcast message, forwarding the instant message to all persistent connections within the service range of the second data center. The server broadcasts the broadcast message; each persistent connection server determines, according to the broadcast message, whether there is a member in the group or the live room corresponding to the object identifier in the persistent connection server; if there is any member in the persistent connection server If the object identifies a member in the corresponding group or live room, the broadcast message is forwarded to each member.

可选的,所述根据所述对象标识,将所述即时消息转发给所述接收对象包括:若所述即时消息为广播消息,则从所述广播消息中获取目标长连接服务器的身份标识,所述目标长连接服务器为所述即时消息的接收对象中的成员所连接的长连接服务器,所述目标长连接服务器位于所述第二数据中心的服务范围内;根据所述目标长连接服务器的身份标识,向所述目标长连接服务器广播所述广播消息;所述目标长连接服务器向与其连接的每个所述成员转发所述广播消息。Optionally, the forwarding the instant message to the receiving object according to the object identifier includes: if the instant message is a broadcast message, acquiring the identity identifier of the target persistent connection server from the broadcast message, The target persistent connection server is the persistent connection server connected to the member in the receiving object of the instant message, and the target persistent connection server is located within the service range of the second data center; an identity identifier, and broadcast the broadcast message to the target persistent connection server; the target persistent connection server forwards the broadcast message to each of the members connected to it.

第三方面,本发明的实施例还提供一种即时消息的传输装置,包括:消息接收单元,用于接收即时消息,所述即时消息携带所述即时消息的接收对象的对象标识,所述即时消息的发出者位于第一数据中心的服务范围内;消息存入单元,用于若所述即时消息的接收对象位于第二数据中心的服务范围内,则将所述即时消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述即时消息并转发给所述接收对象,其中,所述第一数据中心与所述第二数据中心不同。In a third aspect, an embodiment of the present invention further provides an instant message transmission device, comprising: a message receiving unit, configured to receive an instant message, where the instant message carries an object identifier of a recipient of the instant message, the instant message The sender of the message is located within the service scope of the first data center; the message storage unit is configured to store the instant message in the second data center if the recipient of the instant message is located within the service scope of the second data center. A first message queue server in a data center, so that the second data center reads the instant message from the first message queue server and forwards it to the recipient, wherein the first data center and the The second data center described above is different.

可选的,所述消息存入单元包括:第一生成模块,用于若所述即时消息的接收对象处于第二数据中心的服务范围内,且所述即时消息的接收对象为群或直播间,则根据所述即时消息生成广播消息;第一存入模块,用于将所述广播消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述广播消息并向所述第二数据中心的服务范围内的所有长连接服务器广播所述广播消息。Optionally, the message storage unit includes: a first generation module, used for if the recipient of the instant message is within the service range of the second data center, and the recipient of the instant message is a group or a live room , then a broadcast message is generated according to the instant message; the first storing module is used to store the broadcast message in the first message queue server of the first data center, so that the second data center can store the broadcast message from the The first message queue server reads the broadcast message and broadcasts the broadcast message to all persistent connection servers within the service range of the second data center.

可选的,所述消息存入单元包括:查找模块,用于若所述即时消息的接收对象处于第二数据中心的服务范围内,且所述即时消息的接收对象为群或直播间,则查找所述即时消息的接收对象中的各成员所连接的目标长连接服务器,所述目标长连接服务器位于所述第二数据中心的服务范围内;第二生成模块,用于根据所述即时消息生成广播消息,所述广播消息携带所述目标长连接服务器的身份标识;第二存入模块,用于将所述广播消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述广播消息,并向所述目标长连接服务器的身份标识对应的所述长连接服务器广播所述广播消息。Optionally, the message storage unit includes: a search module, configured to: if the recipient of the instant message is within the service range of the second data center, and the recipient of the instant message is a group or a live room, then Searching for the target persistent connection server connected to each member in the recipient of the instant message, and the target persistent connection server is located within the service range of the second data center; a second generation module is configured to generate data according to the instant message generating a broadcast message, the broadcast message carrying the identity of the target long-term connection server; a second storing module for storing the broadcast message in the first message queue server of the first data center, so that all The second data center reads the broadcast message from the first message queue server, and broadcasts the broadcast message to the persistent connection server corresponding to the identity of the target persistent connection server.

可选的,所述即时消息的传输装置还包括:确定单元,用于在所述将所述即时消息存入所述第一数据中心的第一消息队列服务器之前,根据所述接收对象的对象标识,确定所述接收对象所在的数据中心,其中,所述接收对象包括以下任一项:单聊用户、群、直播间,所述群的成员或所述直播间的成员所在的数据中心为一个或多个。Optionally, the instant message transmission apparatus further includes: a determining unit, configured to, before the instant message is stored in the first message queue server of the first data center, according to the object of the receiving object. Identify, determine the data center where the receiving object is located, wherein the receiving object includes any of the following: a single chat user, a group, a live room, and the data center where the members of the group or the members of the live room are located is one or more.

可选的,所述即时消息的传输装置还包括:维护和删除单元,用于在将所述即时消息存入所述第一数据中心的第一消息队列服务器之后,维护所述即时消息,并在所述第二数据中心从所述第一消息队列服务器读取所述即时消息后,将所述即时消息从所述第一消息队列服务器中删除。Optionally, the instant message transmission device further includes: a maintenance and deletion unit, configured to maintain the instant message after the instant message is stored in the first message queue server of the first data center, and After the second data center reads the instant message from the first message queue server, the instant message is deleted from the first message queue server.

第四方面,本发明的实施例还提供一种即时消息的传输装置,包括:消息获取单元,用于从第一数据中心的第一消息队列服务器中获取更新的即时消息,所述即时消息携带所述即时消息的接收对象的对象标识,所述接收对象位于第二数据中心的服务范围内,所述第一数据中心与所述第二数据中心不同;消息转发单元,用于根据所述对象标识,将所述即时消息转发给所述接收对象。In a fourth aspect, an embodiment of the present invention further provides an instant message transmission device, including: a message acquisition unit configured to acquire updated instant messages from a first message queue server in a first data center, the instant messages carrying The object identifier of the recipient of the instant message, the recipient is located in the service range of a second data center, and the first data center is different from the second data center; a message forwarding unit is used for according to the object identifier, and forward the instant message to the recipient.

可选的,所述消息转发单元包括:第一广播模块,用于若所述即时消息为广播消息,则向所述第二数据中心的服务范围内的所有长连接服务器广播所述广播消息;确定模块,用于各所述长连接服务器根据所述广播消息,确定本长连接服务器中是否存在所述对象标识对应的群中或直播间中的成员;第一转发模块,用于若本长连接服务器中存在所述对象标识对应的群中或直播间中的成员,向每个所述成员转发所述广播消息。Optionally, the message forwarding unit includes: a first broadcast module, configured to broadcast the broadcast message to all persistent connection servers within the service range of the second data center if the instant message is a broadcast message; The determining module is used for each of the long-term connection servers to determine, according to the broadcast message, whether there is a member in the group or the live room corresponding to the object identifier in the long-term connection server; the first forwarding module is used for if the long-term connection server is There are members in the group or in the live room corresponding to the object identifier in the connection server, and the broadcast message is forwarded to each of the members.

可选的,所述消息转发单元包括:标识获取模块,用于若所述即时消息为广播消息,则从所述广播消息中获取目标长连接服务器的身份标识,所述目标长连接服务器为所述即时消息的接收对象中的成员所连接的长连接服务器,所述目标长连接服务器位于所述第二数据中心的服务范围内;第二广播模块,用于根据所述目标长连接服务器的身份标识,向所述目标长连接服务器广播所述广播消息;第二转发模块,用于使所述目标长连接服务器向与其连接的每个所述成员转发所述广播消息。Optionally, the message forwarding unit includes: an identifier acquisition module, configured to acquire the identity identifier of the target persistent connection server from the broadcast message if the instant message is a broadcast message, and the target persistent connection server is the target persistent connection server. the persistent connection server connected to the member in the receiving object of the instant message, the target persistent connection server is located in the service range of the second data center; the second broadcasting module is used for according to the identity of the target persistent connection server The identifier is used to broadcast the broadcast message to the target persistent connection server; the second forwarding module is configured to make the target persistent connection server forward the broadcast message to each member connected to it.

第五方面,本发明的实施例还提供一种电子设备,所述电子设备包括:壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为上述电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行本发明的实施例提供的任一种即时消息的传输方法。In a fifth aspect, an embodiment of the present invention further provides an electronic device, the electronic device includes: a casing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is arranged inside the space enclosed by the casing, The processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to each circuit or device of the above electronic equipment; the memory is used to store the executable program code; the processor runs by reading the executable program code stored in the memory The program corresponding to the executable program code is used to execute any instant message transmission method provided by the embodiments of the present invention.

第六方面,本发明的实施例还提供一种电子设备,所述电子设备包括:壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为上述电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行本发明的实施例提供的任一种即时消息的传输方法。In a sixth aspect, an embodiment of the present invention further provides an electronic device, the electronic device includes: a casing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is arranged inside the space enclosed by the casing, The processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to each circuit or device of the above electronic equipment; the memory is used to store the executable program code; the processor runs by reading the executable program code stored in the memory The program corresponding to the executable program code is used to execute any instant message transmission method provided by the embodiments of the present invention.

第七方面,本发明的实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现本发明的实施例提供的任一种即时消息的传输方法。In a seventh aspect, embodiments of the present invention further provide a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors , so as to implement any instant message transmission method provided by the embodiments of the present invention.

第八方面,本发明的实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现本发明的实施例提供的任一种即时消息的传输方法。In an eighth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors , so as to implement any instant message transmission method provided by the embodiments of the present invention.

本发明的实施例提供的即时消息的传输方法、装置、电子设备及存储介质,能够接收第一数据中心的服务范围内的消息发出者发出的即时消息,若所述即时消息的接收对象位于第二数据中心的服务范围内,则将所述即时消息存入所述第一数据中心的第一消息队列务器,以使所述第二数据中心从所述第一消息队列服务器读取所述即时消息并转发给所述接收对象。这样,当消息发出者与消息接收对象分别位于不同的数据中心时,就可以通过第一消息队列服务器使即时消息在两个数据中心之间进行得到及时可靠的同步,而无需采用HTTP或RPD的消息同步方式,从而有效提高了即时消息的传输效率和可靠性。The instant message transmission method, device, electronic device, and storage medium provided by the embodiments of the present invention can receive instant messages sent by message senders within the service scope of the first data center. Within the service scope of the second data center, the instant message is stored in the first message queue server of the first data center, so that the second data center can read the instant message from the first message queue server. instant message and forwarded to the recipient. In this way, when the message sender and the message receiver are located in different data centers, the instant message can be synchronized between the two data centers in a timely and reliable manner through the first message queue server, without using HTTP or RPD. message synchronization, thereby effectively improving the transmission efficiency and reliability of instant messages.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can also be obtained from these drawings without creative effort.

图1为本发明的实施例提供的即时消息的传输方法的一种应用场景示意图;1 is a schematic diagram of an application scenario of an instant message transmission method provided by an embodiment of the present invention;

图2为本发明的实施例提供的即时消息的传输方法的一种流程图;FIG. 2 is a flowchart of an instant message transmission method provided by an embodiment of the present invention;

图3为本发明的实施例提供的即时消息的传输方法的另一种流程图;3 is another flowchart of an instant message transmission method provided by an embodiment of the present invention;

图4为本发明的实施例提供的即时消息的传输方法的一种具体的应用场景示意图;4 is a schematic diagram of a specific application scenario of the instant message transmission method provided by an embodiment of the present invention;

图5为本发明的实施例提供的即时消息的传输装置的一种结构示意图;5 is a schematic structural diagram of an instant message transmission apparatus provided by an embodiment of the present invention;

图6为本发明的实施例提供的即时消息的传输装置的另一种结构示意图;6 is another schematic structural diagram of an instant message transmission apparatus provided by an embodiment of the present invention;

图7为本发明的实施例提供的电子设备的一种结构示意图;7 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention;

图8为本发明的实施例提供的电子设备的一种结构示意图。FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.

具体实施方式Detailed ways

下面结合附图对本发明实施例进行详细描述。The embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

应当明确,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。It should be understood that the described embodiments are only some, but not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

为了对本发明的实施例提供的即时消息的传输方法进行更好的理解,首先对本发明的实施例提供的即时消息的传输方法的应用场景进行简单介绍。In order to better understand the instant message transmission method provided by the embodiment of the present invention, the application scenarios of the instant message transmission method provided by the embodiment of the present invention are briefly introduced first.

在本发明的实施例中,用户之间可以进行即时消息通讯,不同用户之间的即时消息可以通过数据中心进行传递和转发。数据中心可以包括一系列用于即时消息转发的服务,例如,用于长连接的长连接服务器。基于长连接服务,又可以建立多种类型的具体服务形式,例如单聊、群聊、直播间等。In the embodiment of the present invention, instant message communication can be performed between users, and instant messages between different users can be transmitted and forwarded through the data center. A data center may include a series of services for instant message forwarding, eg, a persistent server for persistent connections. Based on the long connection service, various types of specific service forms can be established, such as single chat, group chat, live broadcast room, etc.

如图1所示,当即时消息的发送者向接收对象发送一条即时消息时,该即时消息首先到达发送者所在的数据中心(即第一数据中心),如果第一数据中心发现即时消息的接收对象位于第二数据中心的服务范围内,则可以将该条即时消息存入第一数据中心中的第一消息队列服务器,以便第二数据中心从该第一消息队列服务器读取即时消息。第二数据中心可以监听第一消息队列服务器中的数据更新情况,监听到第一消息队列服务器中的数据更新情况后,可以从第一消息队列服务器中读取该即时消息,并将该即时消息转发给对应的接收对象。这样就无需采用HTTP或RPD的消息同步方式,从而有效提高了即时消息的传输效率和可靠性。As shown in Figure 1, when a sender of an instant message sends an instant message to a recipient, the instant message first arrives at the data center where the sender is located (ie, the first data center). If the first data center finds that the instant message is received If the object is within the service range of the second data center, the instant message can be stored in the first message queue server in the first data center, so that the second data center can read the instant message from the first message queue server. The second data center can monitor the data update situation in the first message queue server, and after monitoring the data update situation in the first message queue server, it can read the instant message from the first message queue server, and send the instant message to the first message queue server. Forwarded to the corresponding recipient. In this way, there is no need to use HTTP or RPD message synchronization, thereby effectively improving the transmission efficiency and reliability of instant messages.

第一方面,本发明的实施例提供一种即时消息的传输方法,基于第一数据中心,能够有效提高即时消息的传输效率和可靠性。In a first aspect, embodiments of the present invention provide an instant message transmission method, which can effectively improve the transmission efficiency and reliability of instant messages based on the first data center.

如图2所示,本发明的实施例提供一种即时消息的传输方法,包括:As shown in FIG. 2, an embodiment of the present invention provides an instant message transmission method, including:

S11,接收即时消息,所述即时消息携带所述即时消息的接收对象的对象标识,所述即时消息的发出者位于第一数据中心的服务范围内;S11. Receive an instant message, where the instant message carries the object identifier of the recipient of the instant message, and the sender of the instant message is located within the service range of the first data center;

本步骤中,第一数据中心可以接收即时消息,可选的,该即时消息既可以是用户输入的消息,例如文字信息、语音信息、视频信息、表情、礼物等,也可以是用户状态改变消息,例如登录或退出消息等。即时消息中可以携带消息接收对象的对象标识和/或携带消息发出者的身份标识。其中,消息接收对象既可以是用户个人,也可以是一个集体,例如一个群或直播间等。In this step, the first data center may receive an instant message. Optionally, the instant message may be a message input by a user, such as text information, voice information, video information, emoticons, gifts, etc., or a user status change message. , such as login or logout messages, etc. The instant message may carry the object identifier of the message recipient and/or the identity identifier of the message sender. The message receiving object may be either an individual user or a collective, such as a group or a live broadcast room.

S12,若所述即时消息的接收对象位于第二数据中心的服务范围内,则将所述即时消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述即时消息并转发给所述接收对象,其中,所述第一数据中心与所述第二数据中心不同。S12, if the recipient of the instant message is located within the service range of the second data center, store the instant message in the first message queue server of the first data center, so that the second data center can send the instant message from The first message queue server reads the instant message and forwards it to the recipient, wherein the first data center is different from the second data center.

本步骤中,第一数据中心接收到即时消息后,可以根据即时消息中接收对象的对象标识确定接收对象是否位于第一数据中心的服务范围内。如果接收对象在第一数据中心的服务范围内,则可以直接在第一数据中心内部将即时消息转发给接收对象,例如可以通过第一数据中心的长连接服务器将即时消息转发给接收对象。如果接收对象在第一数据中心的服务范围以外,例如,位于第二数据中心的服务范围内,则可以将即时消息存入第一数据中心的第一消息队列服务器,以便第二数据中心从第一消息队列服务器读取该即时消息。In this step, after receiving the instant message, the first data center may determine whether the receiving object is located within the service range of the first data center according to the object identifier of the receiving object in the instant message. If the recipient is within the service range of the first data center, the instant message may be directly forwarded to the recipient within the first data center, for example, the instant message may be forwarded to the recipient through the persistent connection server of the first data center. If the recipient is outside the service range of the first data center, for example, is located within the service range of the second data center, the instant message may be stored in the first message queue server of the first data center, so that the second data center can store the instant message in the first message queue server from the second data center. A message queue server reads the instant message.

由于接收对象可以包括多种类型,例如用户个人、群或直播间等,接收对象是否在第一数据中心的服务范围内也可以根据接收对象来具体细分。可选的,在本发明的一个实施例中,当接收对象为用户个人时,即时消息的发出者和接收对象之间可能正在进行单聊,则可以直接确定该接收对象是否在第一数据中心的服务范围内。当接收对象为群或直播间时,可以根据群或直播间中的成员是否在第一数据中心的服务范围内来确定该接收对象是否在第一数据中心的服务范围内。例如,当该群内或直播间内的所有成员都在第一数据中心的服务范围内时,可以认为该接收对象在第一数据中心的服务范围内,只要该群内或直播间内存在至少一个成员位于第一数据中心之外,即可认为该接收对象不在第一数据中心服务范围内。Since the receiving objects may include various types, such as individual users, groups, or live broadcast rooms, whether the receiving objects are within the service scope of the first data center may also be subdivided according to the receiving objects. Optionally, in an embodiment of the present invention, when the recipient is an individual user, there may be a single chat between the sender of the instant message and the recipient, and it can be directly determined whether the recipient is in the first data center. within the scope of services. When the receiving object is a group or a live broadcast room, it may be determined whether the receiving object is within the service scope of the first data center according to whether members of the group or the live broadcast room are within the service scope of the first data center. For example, when all members in the group or in the live broadcast room are within the service range of the first data center, it can be considered that the receiving object is within the service range of the first data center, as long as there are at least If a member is located outside the first data center, it can be considered that the receiving object is not within the service range of the first data center.

可选的,当接收对象为群或直播间时,不在第一数据中心的服务范围内的成员既可以集中分布在另一个数据中心(即一个第二数据中心),也可以分布在另外的多个数据中心(即多个第二数据中心)。若即时消息的接收对象位于一个或多个第二数据中心的服务范围内,则可以将即时消息存入第一数据中心的第一消息队列服务器,以便上述一个或多个第二数据中心从第一消息队列服务器读取该即时消息。Optionally, when the receiving object is a group or a live broadcast room, members who are not within the service scope of the first data center can either be centrally distributed in another data center (that is, a second data center), or distributed in other multiple data centers. data centers (ie, multiple second data centers). If the recipient of the instant message is located within the service range of one or more second data centers, the instant message may be stored in the first message queue server of the first data center, so that the one or more second data centers can transfer the instant message from the first data center to the first message queue server in the first data center. A message queue server reads the instant message.

本发明的实施例提供的即时消息的传输方法,能够接收第一数据中心的服务范围内的消息发出者发出的即时消息,若所述即时消息的接收对象位于第二数据中心的服务范围内,则将所述即时消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述即时消息并转发给所述接收对象。这样,当消息发出者与消息接收对象分别位于不同的数据中心时,就可以通过第一消息队列服务器使即时消息在两个数据中心之间进行得到及时可靠的同步,而无需采用HTTP或RPD的消息同步方式,从而有效提高了即时消息的传输效率和可靠性。The instant message transmission method provided by the embodiment of the present invention can receive the instant message sent by the message sender within the service scope of the first data center. If the recipient of the instant message is within the service scope of the second data center, then store the instant message in the first message queue server of the first data center, so that the second data center reads the instant message from the first message queue server and forwards it to the recipient . In this way, when the message sender and the message receiver are located in different data centers, the instant message can be synchronized between the two data centers in a timely and reliable manner through the first message queue server, without using HTTP or RPD. message synchronization, thereby effectively improving the transmission efficiency and reliability of instant messages.

在步骤S11中第一数据中心接收到即时消息后,可以根据即时消息的接收对象所在的数据中心的不同而对即时消息进行不同方式的转发。可选的,对于也处于第一数据中心服务范围的接收对象,可以直接在第一数据中心内部进行消息转发,对于处于第二数据中心服务范围内的接收对象,则可以先通过第一数据中心的第一消息队列服务器在第一数据中心和第二数据中心之间进行数据同步,随后再由第二数据中心向接收对象转发该即时消息。After receiving the instant message in step S11, the first data center may forward the instant message in different ways according to the difference of the data center where the recipient of the instant message is located. Optionally, for the receiving objects that are also within the service scope of the first data center, the message can be forwarded directly in the first data center, and for the receiving objects that are within the service scope of the second data center, the messages can be forwarded through the first data center first. The first message queue server performs data synchronization between the first data center and the second data center, and then the second data center forwards the instant message to the recipient.

可选的,为了能够获知每个即时消息的接收对象位于哪个数据中心的服务范围内,在本发明的一个实施例中,在第一数据中心接收到即时消息之后,在将所述即时消息存入所述第一数据中心的第一消息队列服务器之前,本发明的实施例提供的即时消息的传输方法还可以包括:根据所述接收对象的对象标识,确定所述接收对象所在的数据中心,其中,所述接收对象包括以下任一项:单聊用户、群、直播间,所述群的成员或所述直播间的成员所在的数据中心可以为一个或多个。当即时消息写入第一数据中心的第一消息队列服务器后,每个成员所在的数据中心都可以从该第一消息队列服务器中读取该即时消息。Optionally, in order to be able to know in which data center the recipient of each instant message is located, in an embodiment of the present invention, after the instant message is received by the first data center, the instant message is stored in the first data center. Before entering the first message queue server of the first data center, the instant message transmission method provided by the embodiment of the present invention may further include: determining the data center where the receiving object is located according to the object identifier of the receiving object, Wherein, the receiving object includes any one of the following: a single chat user, a group, and a live broadcast room, and there may be one or more data centers where the members of the group or the members of the live broadcast room are located. After the instant message is written to the first message queue server of the first data center, the data center where each member is located can read the instant message from the first message queue server.

可选的,在第一数据中心接收到即时消息之后,在将所述即时消息存入所述第一数据中心的第一消息队列服务器之前,还可以对敏感词进行过滤,并将过滤后的即时消息存入第一消息队列服务器,从而可以过滤掉敏感词,有效净化网络空间。Optionally, after the first data center receives the instant message, before storing the instant message in the first message queue server of the first data center, the sensitive words may be filtered, and the filtered The instant messages are stored in the first message queue server, so that sensitive words can be filtered out and the network space can be effectively purified.

在本发明的实施例中,由于即时消息的接收对象不但可以为用户个人,也可以为一个群或直播间,为了使即时消息能够及时送达群或直播间中的每一个成员,可选的,在本发明的一个实施例中,步骤S12中若所述即时消息的接收对象位于第二数据中心的服务范围内,则将所述即时消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述即时消息并转发给所述接收对象具体可以包括:In the embodiment of the present invention, since the recipient of the instant message can be not only an individual user, but also a group or a live room, in order to enable the instant message to be delivered to each member of the group or the live room in time, the optional , in an embodiment of the present invention, in step S12, if the recipient of the instant message is located within the service range of the second data center, the instant message is stored in the first message queue of the first data center server, so that the second data center reads the instant message from the first message queue server and forwards it to the receiving object, which may specifically include:

若所述即时消息的接收对象处于第二数据中心的服务范围内,且所述即时消息的接收对象为群或直播间,则根据所述即时消息生成广播消息;If the recipient of the instant message is within the service range of the second data center, and the recipient of the instant message is a group or a live broadcast room, generating a broadcast message according to the instant message;

将所述广播消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述广播消息并向所述第二数据中心的服务范围内的所有长连接服务器广播所述广播消息。storing the broadcast message in the first message queue server of the first data center so that the second data center reads the broadcast message from the first message queue server and sends the broadcast message to the second data center The broadcast message is broadcast by all persistent connection servers within the service range.

也即是说,本实施例中,若即时消息为群聊消息或直播间消息,则意味着可能有多个成员需要接收到该即时消息,因此,可以根据该即时消息生成对应的广播消息,以便向群或直播间中的其他成员进行广播。That is to say, in this embodiment, if the instant message is a group chat message or a live room message, it means that there may be multiple members who need to receive the instant message. Therefore, a corresponding broadcast message can be generated according to the instant message. to broadcast to other members of the group or room.

可选的,在本发明的一个实施例中,根据即时消息生成的广播消息,可以依据广播消息的属性来分类,并依据不同的广播消息属性进行自定义扩展,不同消息属性可以对应不同的事件处理方式。例如,如果广播消息为群组属性,则广播消息的接收者即为群组ID,相关群组下的成员都可以接收到本消息。如果广播消息是直播间属性,则广播消息的接收者为直播间ID,相关当前直播间的成员也都可以接收到该消息。Optionally, in an embodiment of the present invention, broadcast messages generated according to instant messages can be classified according to the attributes of the broadcast messages, and customized and expanded according to different broadcast message attributes, and different message attributes can correspond to different events. how to handle it. For example, if the broadcast message is a group attribute, the receiver of the broadcast message is the group ID, and all members of the relevant group can receive the message. If the broadcast message is a live room attribute, the receiver of the broadcast message is the live room ID, and all members of the relevant current live room can also receive the message.

可选的,在本发明的一个实施例中,不同数据中心间的消息同步涉及的消息种类可以包括三大类,分别为单聊、群聊及直播间消息,这些大类下又共包括200余种小类,其中大都以直播间的消息为主。不同数据中心之间进行数据传输时,可以进行分别同步,并按照消息协议格式(例如按照消息的大类及小类)分别进行识别保存和传输,以便其它数据中心接收到消息后,进行相应的针对性处理。Optionally, in an embodiment of the present invention, the types of messages involved in the synchronization of messages between different data centers may include three categories, namely single chat, group chat, and live room messages, and these categories include 200 messages in total. There are more than one sub-categories, most of which are based on the news in the live broadcast room. When data transmission is performed between different data centers, they can be synchronized separately, and are identified, saved and transmitted according to the message protocol format (for example, according to the major category and sub-category of the message), so that other data centers receive the message and carry out corresponding processing. Targeted treatment.

可选的,生成广播消息后,可以将广播消息存入第一数据中心的第一消息队列服务器,例如Kafka服务器,以实现数据中心之间的数据同步。其中,Kafka服务器是一种高吞吐量的分布式发布订阅消息系统,能够保存并传输消息数据,从而有效提高数据中心之间消息传输的可靠性和及时性。由于多数据中心之间采用KAFKA服务的方式对即时消息进行保存,数据中心之间唯一交互的只是KAFKA消息队列,因此能够有效的减化服务设计,降低服务架构的复杂性。Optionally, after the broadcast message is generated, the broadcast message may be stored in the first message queue server of the first data center, such as a Kafka server, to realize data synchronization between the data centers. Among them, the Kafka server is a high-throughput distributed publish-subscribe message system, which can save and transmit message data, thereby effectively improving the reliability and timeliness of message transmission between data centers. Because the KAFKA service is used to save instant messages between multiple data centers, the only interaction between the data centers is the KAFKA message queue, which can effectively simplify the service design and reduce the complexity of the service architecture.

可选的,除了Kafka服务器之外,在本发明的其他实施例中也可以采用RabbitMQ、阿里云的全球redis,mongoDB等。由于直播间消息量比较大,可以根据线上实现情况进行选型或者优化定制。Optionally, in addition to the Kafka server, RabbitMQ, Alibaba Cloud's global redis, mongoDB, etc. may also be used in other embodiments of the present invention. Due to the large amount of messages in the live broadcast room, model selection or optimization can be made according to the online implementation.

本实施例中,基于即时消息,广播消息中也可以携带消息的接收对象的身份标识,例如群标识或直播间标识等,但群或直播间中的成员信息在广播消息中可以不体现,从而简化了第一数据中心的数据维护压力,进一步提高了即时消息的传输效率。但本发明的实施例不限于此。In this embodiment, based on the instant message, the broadcast message may also carry the identity identifier of the recipient of the message, such as the group identifier or the live room identifier, etc., but the member information in the group or the live room may not be reflected in the broadcast message, so that The data maintenance pressure of the first data center is simplified, and the transmission efficiency of instant messages is further improved. However, the embodiments of the present invention are not limited thereto.

可选的,在本发明的另一个实施例中,也可以在广播消息中携带群成员或直播间成员相关的信息,从而使第二数据中心能够更快将广播消息转发到对应成员。举例而言,在本发明的一个实施例中,步骤S12中所述若所述即时消息的接收对象位于第二数据中心的服务范围内,则将所述即时消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述即时消息并转发给所述接收对象具体可以包括:Optionally, in another embodiment of the present invention, information related to group members or live room members may also be carried in the broadcast message, so that the second data center can forward the broadcast message to the corresponding members more quickly. For example, in an embodiment of the present invention, in step S12, if the recipient of the instant message is located within the service range of the second data center, the instant message is stored in the first data center The first message queue server, so that the second data center reads the instant message from the first message queue server and forwards it to the recipient, which may specifically include:

若所述即时消息的接收对象处于第二数据中心的服务范围内,且所述即时消息的接收对象为群或直播间,则查找所述即时消息的接收对象中的各成员所连接的目标长连接服务器,所述目标长连接服务器位于所述第二数据中心的服务范围内;If the recipient of the instant message is within the service range of the second data center, and the recipient of the instant message is a group or a live broadcast room, search for the target long-distance connection to which each member of the recipient of the instant message is connected a connection server, where the target persistent connection server is located within the service range of the second data center;

根据所述即时消息生成广播消息,所述广播消息携带所述目标长连接服务器的身份标识;Generate a broadcast message according to the instant message, and the broadcast message carries the identity of the target persistent connection server;

将所述广播消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述广播消息,并向所述目标长连接服务器的身份标识对应的所述长连接服务器广播所述广播消息。storing the broadcast message in the first message queue server of the first data center, so that the second data center reads the broadcast message from the first message queue server and makes a long connection to the target The persistent connection server corresponding to the identity of the server broadcasts the broadcast message.

具体而言,在本发明的实施例中,为了保证即时消息的实时性,当用户发送或接收即时消息前,可以先与一个长连接服务器建立并维持长连接,并以此长连接为基础,建立多种具体的消息服务,例如单聊(chat)、群聊(group chat)、直播间(room)等。在群聊或直播间中,即时消息需要转发给群或直播间中的所有成员。可选的,这些成员所连接的长连接服务器可以相同,也可以不同,例如群成员A1、A2、A3都处于第二数据中心的服务范围内,A1、A2、A3既可以连接在同一个目标长连接服务器server1上,也可以A1、A2连接在目标长连接服务器server1上,A3连接在目标长连接服务器server2上。Specifically, in the embodiment of the present invention, in order to ensure the real-time nature of instant messages, before a user sends or receives instant messages, a persistent connection can be established and maintained with a persistent connection server, and based on this persistent connection, Establish a variety of specific message services, such as single chat (chat), group chat (group chat), live room (room) and so on. In a group chat or live room, instant messages need to be forwarded to all members of the group or live room. Optionally, the persistent connection servers to which these members are connected may be the same or different. For example, group members A1, A2, and A3 are all within the service range of the second data center, and A1, A2, and A3 may be connected to the same target. On the persistent connection server server1, A1 and A2 can also be connected to the target persistent connection server server1, and A3 can be connected to the target persistent connection server server2.

本实施例中,第一数据中心可以维护一个用户与长连接服务器的对应关系表,根据该对应关系表可以查找到与群或直播间成员建立连接的长连接服务器,并将该长连接服务器的身份标识添加到广播消息中。这样,当第二数据中心从第一消息队列服务器读取该广播消息时,就可以获知该广播消息应该被转发到哪些对应的长连接服务器上,并进一步转发给该长连接服务器下连接的用户。In this embodiment, the first data center may maintain a correspondence table between the user and the persistent connection server, and according to the correspondence table, the persistent connection server that establishes a connection with the group or live room member can be found, and the persistent connection server of the persistent connection server can be found. The identity is added to the broadcast message. In this way, when the second data center reads the broadcast message from the first message queue server, it can know which corresponding persistent connection servers the broadcast message should be forwarded to, and further forward it to the users connected to the persistent connection server. .

由于将即时消息或广播消息存入第一消息队列服务器涉及到外部数据交互,为了提高消息的处理效率,可选的,在本发明的一个实施例中,可以通过一个单独的服务来处理这些耗时业务,例如专门处理保存数据库,操作消息队列,操作缓存等的服务。Since storing instant messages or broadcast messages in the first message queue server involves external data interaction, in order to improve message processing efficiency, optionally, in an embodiment of the present invention, a separate service may be used to process these consumptions. Time services, such as services dedicated to saving databases, operating message queues, operating caches, etc.

进一步的,在步骤S12中将即时消息存入第一数据中心的第一消息队列服务器之后,本发明的实施例提供的即时消息的传输方法还可以包括:维护所述即时消息,并在所述第二数据中心从所述第一消息队列服务器读取所述即时消息后,将所述即时消息从所述第一消息队列服务器中删除。这样,基于即时消息消费后再删除的机制,可以使得每一条消息都能够得以完整消费,从而有效解决了弱网环境下的消息丢失问题,有效提高即时消息传输的可靠性。Further, after the instant message is stored in the first message queue server of the first data center in step S12, the instant message transmission method provided by the embodiment of the present invention may further include: maintaining the instant message, and storing the instant message in the After reading the instant message from the first message queue server, the second data center deletes the instant message from the first message queue server. In this way, based on the mechanism of instant message consumption and then deletion, each message can be completely consumed, thereby effectively solving the problem of message loss in a weak network environment, and effectively improving the reliability of instant message transmission.

第二方面,本发明的实施例还提供一种即时消息的传输方法,基于第二数据中心,能够有效提高即时消息的传输效率和可靠性。In a second aspect, the embodiments of the present invention further provide a method for transmitting instant messages, which can effectively improve the transmission efficiency and reliability of instant messages based on the second data center.

如图3所示,本发明的实施例提供一种即时消息的传输方法,可以包括:As shown in FIG. 3, an embodiment of the present invention provides an instant message transmission method, which may include:

S21,从第一数据中心的第一消息队列服务器中获取更新的即时消息,所述即时消息携带所述即时消息的接收对象的对象标识,所述接收对象位于第二数据中心的服务范围内,所述第一数据中心与所述第二数据中心不同;S21: Acquire an updated instant message from a first message queue server in a first data center, where the instant message carries an object identifier of a recipient of the instant message, and the recipient is located within the service range of the second data center, the first data center is different from the second data center;

本步骤中,第二数据中心可以监听第一消息队列服务器中的消息更新情况,一旦发现消息更新,第二数据中心即可以从第一消息队列服务器中读取更新的即时消息。可选的,该即时消息既可以是用户输入的消息,例如文字信息、表情、礼物等,也可以是用户状态改变消息,例如登录或退出消息等。In this step, the second data center can monitor the message update situation in the first message queue server, and once the message update is found, the second data center can read the updated instant message from the first message queue server. Optionally, the instant message may be either a message input by the user, such as text information, emoticons, gifts, etc., or a user status change message, such as a login or logout message.

由于读取即时消息涉及到外部数据交互,为了提高消息的处理效率,可选的,在本发明的一个实施例中,可以通过一个单独的服务来处理这些耗时业务,例如专门处理保存数据库,操作消息队列,操作缓存等的服务。Since reading instant messages involves external data interaction, in order to improve message processing efficiency, optionally, in an embodiment of the present invention, a separate service can be used to process these time-consuming services, such as special processing of saving a database, Services that operate message queues, operate caches, etc.

S22,根据所述对象标识,将所述即时消息转发给所述接收对象。S22: Forward the instant message to the recipient according to the object identifier.

在本发明的实施例中,第二数据中心获取了即时消息后,即可以根据即时消息中携带的接收对象的对象标识,将该即时消息转发给对应的接收对象。可选的,即时消息的接收对象既可以是用户个人,也可以是一个集体,例如一个群或直播间等。可选的,当接收对象为群或直播间时,将即时消息转发给接收对象也就是将即时消息转发给群中或直播间中的每个成员。In the embodiment of the present invention, after acquiring the instant message, the second data center can forward the instant message to the corresponding recipient according to the object identifier of the recipient carried in the instant message. Optionally, the recipient of the instant message may be either an individual user or a group, such as a group or a live broadcast room. Optionally, when the receiving object is a group or a live broadcast room, forwarding the instant message to the receiving object means forwarding the instant message to each member in the group or the live broadcast room.

本发明的实施例提供的即时消息的传输方法,第二数据中心能够从第一数据中心的第一消息队列服务器中获取更新的即时消息,所述即时消息携带所述即时消息的接收对象的对象标识,所述接收对象位于第二数据中心的服务范围内,并根据所述对象标识,将所述即时消息转发给所述接收对象。这样,当消息发出者与消息接收对象分别位于不同的数据中心时,就可以通过第一消息队列服务器使即时消息在两个数据中心之间进行得到及时可靠的同步,而无需采用HTTP或RPD的消息同步方式,从而有效提高了即时消息的传输效率和可靠性。In the instant message transmission method provided by the embodiment of the present invention, the second data center can obtain the updated instant message from the first message queue server of the first data center, and the instant message carries the object of the receiving object of the instant message The receiving object is located in the service range of the second data center, and the instant message is forwarded to the receiving object according to the object identification. In this way, when the message sender and the message receiver are located in different data centers, the instant message can be synchronized between the two data centers in a timely and reliable manner through the first message queue server, without using HTTP or RPD. message synchronization, thereby effectively improving the transmission efficiency and reliability of instant messages.

可选的,在本发明的一个实施例中,获取到即时消息后,第二数据中心可以根据即时消息的消息格式(例如预设关键字)确定该即时消息是单发消息还是广播消息。若为广播消息,则可以向即时消息的接收对象中的各成员广播该即时消息。具体而言,在本发明的一个实施例中,步骤S22中根据所述对象标识,将所述即时消息转发给所述接收对象具体可以包括:Optionally, in an embodiment of the present invention, after acquiring the instant message, the second data center may determine whether the instant message is a single-send message or a broadcast message according to the message format of the instant message (for example, a preset keyword). If it is a broadcast message, the instant message can be broadcast to each member of the recipient of the instant message. Specifically, in an embodiment of the present invention, according to the object identifier in step S22, forwarding the instant message to the receiving object may specifically include:

若所述即时消息为广播消息,则向所述第二数据中心的服务范围内的所有长连接服务器广播所述广播消息;If the instant message is a broadcast message, broadcast the broadcast message to all persistent connection servers within the service range of the second data center;

各所述长连接服务器根据所述广播消息,确定本长连接服务器中是否存在所述对象标识对应的群中或直播间中的成员;Each of the persistent connection servers determines, according to the broadcast message, whether there is a member in the group or live room corresponding to the object identifier in the persistent connection server;

若本长连接服务器中存在所述对象标识对应的群中或直播间中的成员,则向每个所述成员转发所述广播消息。If there are members in the group or in the live room corresponding to the object identifier in the persistent connection server, the broadcast message is forwarded to each of the members.

具体而言,本实施例中,如果第二数据中心从第一消息队列服务器中获取到的即时消息是一种广播消息,则可以向第二数据中心服务范围内的所有长连接服务器广播该广播消息。相应的,各长连接服务器在接收到该广播消息后,可以根据各自维护的用户状态列表,确定本长连接服务器中是否存在所述对象标识对应的群中或直播间中的成员。每当有新用户连接到长连接服务器时,若存在,则向该群或直播间中连接于该长连接服务器下的每个成员转发该广播消息,若不存在,则无需进行上述广播消息的转发。例如,长连接服务器server6可以根据用户状态列表获知群C中的成员C2、C8连接于本长连接服务器,长连接服务器server4可以根据用户状态列表获知群C中的成员C1、C3、C4、C9连接于本长连接服务器,则长连接服务器server6可以向成员C2、C8转发该广播消息,长连接服务器server4可以向成员C1、C3、C4、C9转发该广播消息。长连接服务器server2根据用户状态列表获知群C中的成员没有连接于本长连接服务器中,则长连接服务器server2无需对该广播消息进行进一步转发,丢弃即可。Specifically, in this embodiment, if the instant message obtained by the second data center from the first message queue server is a broadcast message, the broadcast can be broadcast to all persistent connection servers within the service range of the second data center information. Correspondingly, after receiving the broadcast message, each persistent connection server can determine whether there is a member in the group or live room corresponding to the object identifier in the persistent connection server according to the user status list maintained by each persistent connection server. Whenever a new user connects to the persistent connection server, if it exists, the broadcast message will be forwarded to each member of the group or live room connected to the persistent connection server. Forward. For example, the persistent connection server server6 can know that members C2 and C8 in group C are connected to this persistent connection server according to the user status list, and the persistent connection server server4 can know that members C1, C3, C4, and C9 in group C are connected according to the user status list. For this persistent connection server, the persistent connection server server6 may forward the broadcast message to the members C2 and C8, and the persistent connection server server4 may forward the broadcast message to the members C1, C3, C4, and C9. The persistent connection server server2 learns according to the user status list that the members in the group C are not connected to the persistent connection server, and the persistent connection server server2 does not need to further forward the broadcast message, but just discards it.

在本发明的前一个实施例中,第二数据中心会将从第一消息队列服务器中获取的即时消息向第二数据中心服务范围内的所有长连接服务器广播,由每个长连接服务器来确定是否需要对即时消息进一步转发,或者向哪些用户进一步转发。但本发明的实施例不限于此。在本发明的其他实施例中,也可以通过其他方式进行即时消息的转发。In the previous embodiment of the present invention, the second data center will broadcast the instant message obtained from the first message queue server to all the persistent connection servers within the service range of the second data center, which is determined by each persistent connection server Whether the instant message needs to be forwarded further, or to which users. However, the embodiments of the present invention are not limited thereto. In other embodiments of the present invention, the instant message may also be forwarded in other ways.

例如,可选的,在本发明的另一个实施例中,步骤S22中根据所述对象标识,将所述即时消息转发给所述接收对象具体可以包括:For example, optionally, in another embodiment of the present invention, according to the object identifier in step S22, forwarding the instant message to the receiving object may specifically include:

若所述即时消息为广播消息,则从所述广播消息中获取目标长连接服务器的身份标识,所述目标长连接服务器为所述即时消息的接收对象中的成员所连接的长连接服务器,所述目标长连接服务器位于所述第二数据中心的服务范围内;If the instant message is a broadcast message, the identity of the target persistent connection server is obtained from the broadcast message, and the target persistent connection server is the persistent connection server connected to the member in the recipient of the instant message, so The target persistent connection server is located within the service scope of the second data center;

根据所述目标长连接服务器的身份标识,向所述目标长连接服务器广播所述广播消息;Broadcast the broadcast message to the target persistent connection server according to the identity of the target persistent connection server;

所述目标长连接服务器向与其连接的每个所述成员转发所述广播消息。The target persistent connection server forwards the broadcast message to each of the members connected to it.

也即是说,本实施例中,第二数据中心从第一消息队列服务器获取到的即时消息为一种广播消息,且该广播消息中携带有接收对象中的各成员所连接的长连接服务器(即目标长连接服务器)的身份标识。因此,第二数据中心可以直接根据目标长连接服务器的身份标识,向对应的目标长连接服务器转发该广播消息,从而使广播消息的转发更具有针对性,也有效提高了即时消息的传输效率。That is to say, in this embodiment, the instant message obtained by the second data center from the first message queue server is a broadcast message, and the broadcast message carries the persistent connection server connected to each member of the receiving object. (that is, the identity of the target persistent connection server). Therefore, the second data center can directly forward the broadcast message to the corresponding target persistent connection server according to the identity of the target persistent connection server, thereby making the forwarding of the broadcast message more targeted and effectively improving the transmission efficiency of instant messages.

结合前述基于第一数据中心的即时消息传输方法和基于第二数据中心的即时消息传输方法,在本发明的一个实施例中,第一数据中心和第二数据中心的结构示意图可以如图4所示。In combination with the aforementioned method for transmitting instant messages based on the first data center and the method for transmitting instant messages based on the second data center, in an embodiment of the present invention, the schematic structural diagrams of the first data center and the second data center may be as shown in FIG. 4 . Show.

图4中左侧例如可以为关东数据中心,右侧例如可以为中东数据中心。用户聊天时可以就近接入其中一个物理位置较近,网络速度更佳的数据中心,来进行相关业务数据的处理。In FIG. 4 , the left side may be, for example, the Kanto data center, and the right side may be, for example, the Middle East data center. When chatting, users can access a nearby data center with a relatively close physical location and a better network speed to process related business data.

其中,每个数据中心下可以设置一个或多个LIVE服务器。LIVE服务器为长连接服务器,用户的服务状态信息均可以保存在该服务上。在LIVE服务器提供的长连接服务的基础上,又设置单聊(chat)、群聊(group chat)及直播间聊天(room)三种具体的聊天方式。如果即时消息为直播间消息时,则可以将即时消息路由至ROOM服务器。聊天的用户可以来自全球各个国家或地区。举例而言,在本发明的一个实施例中,用户的服务状态信息可以包括直播间的当前状态等信息,例如当用户新加入某直播间或者切换直播间时,均可以将相应的直播间ID同步至LIVE服务器对应的直播间中。Among them, one or more LIVE servers can be set under each data center. The LIVE server is a persistent connection server, and the user's service status information can be saved on this service. On the basis of the long connection service provided by the LIVE server, three specific chat methods are set up: single chat (chat), group chat (group chat) and live room chat (room). If the instant message is a live room message, the instant message can be routed to the ROOM server. Chat users can come from various countries or regions around the world. For example, in an embodiment of the present invention, the user's service status information may include information such as the current status of the live room, for example, when the user newly joins a live room or switches a live room, the corresponding live room ID can be Sync to the live room corresponding to the LIVE server.

用户使用即时消息功能前首先需要与LIVE服务器建立长连接,并维持长连接。单聊、群聊及直播间中所产生的消息数据可以通过REDIS缓存来暂时快速保存。REDIS中的消息数据可以不断被更新,可以通过TASK服务将REDIS中暂存的消息数据转存到MONGO数据库中,从而为新数据赢得更多的存储空间。其中,TASK服务为耗时业务处理任务服务,可以进行例如保存数据库,操作消息队列,操作缓存等服务。MONGO数据库为消息落地数据库,其存储容量巨大但存取速度相对较慢。Before using the instant messaging function, users need to establish a long connection with the LIVE server and maintain the long connection. The message data generated in single chat, group chat and live broadcast room can be temporarily and quickly saved through REDIS cache. The message data in REDIS can be continuously updated, and the temporarily stored message data in REDIS can be transferred to the MONGO database through the TASK service, thereby gaining more storage space for new data. Among them, the TASK service is a time-consuming business processing task service, which can perform services such as saving databases, operating message queues, and operating caches. MONGO database is a message landing database with huge storage capacity but relatively slow access speed.

当不同的数据中心之间需要进行数据同步时,暂存在REDIS中的即时消息数据可以通过TASK服务存入KAFKA服务器。KAFKA服务为消息队列服务,可以用于保存并传输消息数据。其他数据中心的TASK服务可以监听该KAFKA服务的消息更新,从KAFKA服务中读取更新的消息,并将读取到的消息通过LIVE服务器转发给该消息的接收对象。即时消息通过消息队列服务器(例如KAFKA服务器)在不同的数据中心之间的传输过程,已经在前文进行了详细说明,此处不在赘述。When data synchronization is required between different data centers, the instant message data temporarily stored in REDIS can be stored in the KAFKA server through the TASK service. The KAFKA service is a message queue service that can be used to save and transmit message data. The TASK service in other data centers can monitor the message update of the KAFKA service, read the updated message from the KAFKA service, and forward the read message to the recipient of the message through the LIVE server. The transmission process of instant messages between different data centers through a message queue server (such as a KAFKA server) has been described in detail above, and will not be repeated here.

第三方面,本发明的实施例还提供一种即时消息的传输装置,能够有效提高即时消息的传输效率和可靠性。In a third aspect, embodiments of the present invention further provide an instant message transmission device, which can effectively improve the transmission efficiency and reliability of instant messages.

如图5所示,本发明的实施例提供的即时消息的传输装置,可以包括:As shown in FIG. 5 , the instant message transmission apparatus provided by the embodiment of the present invention may include:

消息接收单元31,用于接收即时消息,所述即时消息携带所述即时消息的接收对象的对象标识,所述即时消息的发出者位于第一数据中心的服务范围内;Amessage receiving unit 31, configured to receive an instant message, where the instant message carries the object identifier of the recipient of the instant message, and the sender of the instant message is located within the service scope of the first data center;

消息存入单元32,用于若所述即时消息的接收对象位于第二数据中心的服务范围内,则将所述即时消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述即时消息并转发给所述接收对象,其中,所述第一数据中心与所述第二数据中心不同。Themessage storage unit 32 is configured to store the instant message in the first message queue server of the first data center if the recipient of the instant message is located within the service range of the second data center, so that all The second data center reads the instant message from the first message queue server and forwards it to the recipient, wherein the first data center is different from the second data center.

本发明的实施例提供的即时消息的传输装置,能够接收第一数据中心的服务范围内的消息发出者发出的即时消息,若所述即时消息的接收对象位于第二数据中心的服务范围内,则将所述即时消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述即时消息并转发给所述接收对象。这样,当消息发出者与消息接收对象分别位于不同的数据中心时,就可以通过第一消息队列服务器使即时消息在两个数据中心之间进行得到及时可靠的同步,而无需采用HTTP或RPD的消息同步方式,从而有效提高了即时消息的传输效率和可靠性。The instant message transmission device provided by the embodiment of the present invention can receive the instant message sent by the message sender within the service scope of the first data center. If the recipient of the instant message is within the service scope of the second data center, then store the instant message in the first message queue server of the first data center, so that the second data center reads the instant message from the first message queue server and forwards it to the recipient . In this way, when the message sender and the message receiver are located in different data centers, the instant message can be synchronized between the two data centers in a timely and reliable manner through the first message queue server, without using HTTP or RPD. message synchronization, thereby effectively improving the transmission efficiency and reliability of instant messages.

可选的,消息存入单元32可以包括:Optionally, themessage storage unit 32 may include:

第一生成模块,用于若所述即时消息的接收对象处于第二数据中心的服务范围内,且所述即时消息的接收对象为群或直播间,则根据所述即时消息生成广播消息;a first generating module, configured to generate a broadcast message according to the instant message if the recipient of the instant message is within the service range of the second data center, and the recipient of the instant message is a group or a live room;

第一存入模块,用于将所述广播消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述广播消息并向所述第二数据中心的服务范围内的所有长连接服务器广播所述广播消息。a first storing module, configured to store the broadcast message in the first message queue server of the first data center, so that the second data center reads the broadcast message from the first message queue server and broadcast the broadcast message to all persistent connection servers within the service range of the second data center.

可选的,消息存入单元32可以包括:Optionally, themessage storage unit 32 may include:

查找模块,用于若所述即时消息的接收对象处于第二数据中心的服务范围内,且所述即时消息的接收对象为群或直播间,则查找所述即时消息的接收对象中的各成员所连接的目标长连接服务器,所述目标长连接服务器位于所述第二数据中心的服务范围内;A search module, configured to search for each member of the instant message recipient if the recipient of the instant message is within the service range of the second data center, and the recipient of the instant message is a group or a live room The connected target persistent connection server, the target persistent connection server is located within the service range of the second data center;

第二生成模块,用于根据所述即时消息生成广播消息,所述广播消息携带所述目标长连接服务器的身份标识;a second generating module, configured to generate a broadcast message according to the instant message, where the broadcast message carries the identity of the target persistent connection server;

第二存入模块,用于将所述广播消息存入所述第一数据中心的第一消息队列服务器,以使所述第二数据中心从所述第一消息队列服务器读取所述广播消息,并向所述目标长连接服务器的身份标识对应的所述长连接服务器广播所述广播消息。A second storing module, configured to store the broadcast message in the first message queue server of the first data center, so that the second data center can read the broadcast message from the first message queue server , and broadcast the broadcast message to the persistent connection server corresponding to the identity of the target persistent connection server.

可选的,所述即时消息的传输装置还可以包括:Optionally, the instant message transmission device may further include:

确定单元,用于在所述将所述即时消息存入所述第一数据中心的第一消息队列服务器之前,根据所述接收对象的对象标识,确定所述接收对象所在的数据中心,其中,所述接收对象包括以下任一项:单聊用户、群、直播间,所述群的成员或所述直播间的成员所在的数据中心为一个或多个。a determining unit, configured to determine the data center where the receiving object is located according to the object identifier of the receiving object before the instant message is stored in the first message queue server of the first data center, wherein, The receiving objects include any one of the following: a single chat user, a group, and a live broadcast room, and one or more data centers where members of the group or members of the live broadcast room are located.

可选的,所述即时消息的传输装置还可以包括:Optionally, the instant message transmission device may further include:

维护和删除单元,用于在将所述即时消息存入所述第一数据中心的第一消息队列服务器之后,维护所述即时消息,并在所述第二数据中心从所述第一消息队列服务器读取所述即时消息后,将所述即时消息从所述第一消息队列服务器中删除。A maintenance and deletion unit, configured to maintain the instant message after the instant message is stored in the first message queue server of the first data center, and delete the instant message from the first message queue in the second data center After reading the instant message, the server deletes the instant message from the first message queue server.

第四方面,本发明的实施例还提供一种即时消息的传输方法,基于第二数据中心,能够有效提高即时消息的传输效率和可靠性。In a fourth aspect, an embodiment of the present invention further provides an instant message transmission method, which can effectively improve the instant message transmission efficiency and reliability based on the second data center.

如图6所示,本发明的实施例提供的即时消息的传输装置,可以包括:As shown in FIG. 6 , the instant message transmission apparatus provided by the embodiment of the present invention may include:

消息获取单元41,用于从第一数据中心的第一消息队列服务器中获取更新的即时消息,所述即时消息携带所述即时消息的接收对象的对象标识,所述接收对象位于第二数据中心的服务范围内,所述第一数据中心与所述第二数据中心不同;Amessage obtaining unit 41, configured to obtain an updated instant message from the first message queue server in the first data center, where the instant message carries the object identifier of the recipient of the instant message, and the recipient is located in the second data center Within the scope of service, the first data center is different from the second data center;

消息转发单元42,用于根据所述对象标识,将所述即时消息转发给所述接收对象。Themessage forwarding unit 42 is configured to forward the instant message to the receiving object according to the object identifier.

本发明的实施例提供的即时消息的传输装置,能够从第一数据中心的第一消息队列服务器中获取更新的即时消息,所述即时消息携带所述即时消息的接收对象的对象标识,所述接收对象位于第二数据中心的服务范围内,并根据所述对象标识,将所述即时消息转发给所述接收对象。这样,当消息发出者与消息接收对象分别位于不同的数据中心时,就可以通过第一消息队列服务器使即时消息在两个数据中心之间进行得到及时可靠的同步,而无需采用HTTP或RPD的消息同步方式,从而有效提高了即时消息的传输效率和可靠性。The instant message transmission device provided by the embodiment of the present invention can obtain the updated instant message from the first message queue server in the first data center, the instant message carries the object identifier of the recipient of the instant message, and the instant message The receiving object is located within the service range of the second data center, and according to the object identifier, the instant message is forwarded to the receiving object. In this way, when the message sender and the message receiver are located in different data centers, the instant message can be synchronized between the two data centers in a timely and reliable manner through the first message queue server, without using HTTP or RPD. message synchronization, thereby effectively improving the transmission efficiency and reliability of instant messages.

可选的,消息转发单元42可以包括:Optionally, themessage forwarding unit 42 may include:

第一广播模块,用于若所述即时消息为广播消息,则向所述第二数据中心的服务范围内的所有长连接服务器广播所述广播消息;a first broadcast module, configured to broadcast the broadcast message to all persistent connection servers within the service range of the second data center if the instant message is a broadcast message;

确定模块,用于各所述长连接服务器根据所述广播消息,确定本长连接服务器中是否存在所述对象标识对应的群中或直播间中的成员;A determination module, used for each of the long-connection servers to determine, according to the broadcast message, whether there is a member in the group or the live room corresponding to the object identifier in the long-connection server;

第一转发模块,用于若本长连接服务器中存在所述对象标识对应的群中或直播间中的成员,则向每个所述成员转发所述广播消息。The first forwarding module is configured to forward the broadcast message to each member if there are members in the group or the live room corresponding to the object identifier in the persistent connection server.

可选的,消息转发单元42可以包括:Optionally, themessage forwarding unit 42 may include:

标识获取模块,用于若所述即时消息为广播消息,则从所述广播消息中获取目标长连接服务器的身份标识,所述目标长连接服务器为所述即时消息的接收对象中的成员所连接的长连接服务器,所述目标长连接服务器位于所述第二数据中心的服务范围内;An identity acquisition module, configured to acquire the identity of a target persistent connection server from the broadcast message if the instant message is a broadcast message, and the target persistent connection server is connected to a member in the receiving object of the instant message The persistent connection server, the target persistent connection server is located within the service range of the second data center;

第二广播模块,用于根据所述目标长连接服务器的身份标识,向所述目标长连接服务器广播所述广播消息;a second broadcasting module, configured to broadcast the broadcast message to the target persistent connection server according to the identity of the target persistent connection server;

第二转发模块,用于使所述目标长连接服务器向与其连接的每个所述成员转发所述广播消息。The second forwarding module is configured to make the target persistent connection server forward the broadcast message to each member connected to it.

相应的,第五方面,本发明实施例提供一种电子设备,能够有效提高即时消息的传输效率和可靠性。Correspondingly, in a fifth aspect, an embodiment of the present invention provides an electronic device, which can effectively improve the transmission efficiency and reliability of instant messages.

如图7所示,本发明的实施例提供的电子设备,可以包括:壳体51、处理器52、存储器53、电路板54和电源电路55,其中,电路板54安置在壳体51围成的空间内部,处理器52和存储器53设置在电路板54上;电源电路55,用于为上述电子设备的各个电路或器件供电;存储器53用于存储可执行程序代码;处理器52通过读取存储器53中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行前述任一实施例提供的即时消息的传输方法。As shown in FIG. 7 , the electronic device provided by the embodiment of the present invention may include: acasing 51 , aprocessor 52 , amemory 53 , acircuit board 54 and apower supply circuit 55 , wherein thecircuit board 54 is arranged on thecasing 51 to surround Inside the space, theprocessor 52 and thememory 53 are arranged on thecircuit board 54; thepower supply circuit 55 is used to supply power to each circuit or device of the above-mentioned electronic equipment; thememory 53 is used to store executable program codes; The executable program code stored in thememory 53 is used to execute the program corresponding to the executable program code, and is used to execute the instant message transmission method provided by any of the foregoing embodiments.

处理器52对上述步骤的具体执行过程以及处理器52通过运行可执行程序代码来进一步执行的步骤,可以参见前述实施例的描述,在此不再赘述。For the specific execution process of the above steps by theprocessor 52 and the further steps performed by theprocessor 52 by running the executable program code, reference may be made to the descriptions of the foregoing embodiments, and details are not repeated here.

相应的,第六方面,本发明实施例提供一种电子设备,能够有效提高即时消息的传输效率和可靠性。Correspondingly, in a sixth aspect, an embodiment of the present invention provides an electronic device, which can effectively improve the transmission efficiency and reliability of instant messages.

如图8所示,本发明的实施例提供的电子设备,可以包括:壳体61、处理器62、存储器63、电路板64和电源电路65,其中,电路板64安置在壳体61围成的空间内部,处理器62和存储器63设置在电路板64上;电源电路65,用于为上述电子设备的各个电路或器件供电;存储器63用于存储可执行程序代码;处理器62通过读取存储器63中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行前述任一实施例提供的即时消息的传输方法。As shown in FIG. 8 , the electronic device provided by the embodiment of the present invention may include: acasing 61 , aprocessor 62 , amemory 63 , acircuit board 64 and apower supply circuit 65 , wherein thecircuit board 64 is arranged on thecasing 61 to surround Inside the space, theprocessor 62 and thememory 63 are arranged on thecircuit board 64; thepower circuit 65 is used to supply power to each circuit or device of the above-mentioned electronic equipment; thememory 63 is used to store executable program codes; The executable program code stored in thememory 63 is used to run a program corresponding to the executable program code, and is used to execute the instant message transmission method provided by any of the foregoing embodiments.

处理器62对上述步骤的具体执行过程以及处理器62通过运行可执行程序代码来进一步执行的步骤,可以参见前述实施例的描述,在此不再赘述。For the specific execution process of the above steps by theprocessor 62 and the further steps performed by theprocessor 62 by running the executable program code, reference may be made to the description of the foregoing embodiments, and details are not repeated here.

上述电子设备以多种形式存在,包括但不限于:The above electronic devices exist in various forms, including but not limited to:

(1)移动通信设备:这类设备的特点是具备移动通信功能,并且以提供话音、数据通信为主要目标。这类终端包括:智能手机(例如iPhone)、多媒体手机、功能性手机,以及低端手机等。(1) Mobile communication equipment: This type of equipment is characterized by having mobile communication functions, and its main goal is to provide voice and data communication. Such terminals include: smart phones (eg iPhone), multimedia phones, functional phones, and low-end phones.

(2)超移动个人计算机设备:这类设备属于个人计算机的范畴,有计算和处理功能,一般也具备移动上网特性。这类终端包括:PDA、MID和UMPC设备等,例如iPad。(2) Ultra-mobile personal computer equipment: This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has the characteristics of mobile Internet access. Such terminals include: PDAs, MIDs, and UMPC devices, such as iPads.

(3)便携式娱乐设备:这类设备可以显示和播放多媒体内容。该类设备包括:音频、视频播放器(例如iPod),掌上游戏机,电子书,以及智能玩具和便携式车载导航设备。(3) Portable entertainment equipment: This type of equipment can display and play multimedia content. Such devices include: audio and video players (eg iPod), handheld game consoles, e-books, as well as smart toys and portable car navigation devices.

(4)服务器:提供计算服务的设备,服务器的构成包括处理器、硬盘、内存、系统总线等,服务器和通用的计算机架构类似,但是由于需要提供高可靠的服务,因此在处理能力、稳定性、可靠性、安全性、可扩展性、可管理性等方面要求较高。(4) Server: A device that provides computing services. The composition of the server includes a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but due to the need to provide highly reliable services, the processing capacity, stability , reliability, security, scalability, manageability and other aspects of high requirements.

(5)其他具有数据交互功能的电子设备。(5) Other electronic devices with data interaction function.

相应的,第七方面,本发明的实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现前述实施例提供的任一种即时消息的传输方法,因此也能实现相应的技术效果,前文已经进行了详细说明,此处不再赘述。Correspondingly, in a seventh aspect, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs can be stored by one or more The processor executes to implement any of the instant message transmission methods provided in the foregoing embodiments, and thus can also achieve corresponding technical effects, which have been described in detail above, and will not be repeated here.

相应的,第八方面,本发明的实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现前述实施例提供的任一种即时消息的传输方法,因此也能实现相应的技术效果,前文已经进行了详细说明,此处不再赘述。Correspondingly, in the eighth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs can be stored by one or more programs The processor executes to implement any of the instant message transmission methods provided in the foregoing embodiments, and thus can also achieve corresponding technical effects, which have been described in detail above, and will not be repeated here.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个......”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. any such actual relationship or sequence exists. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。Each embodiment in this specification is described in a related manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments.

尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。In particular, for the apparatus embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for related parts.

为了描述的方便,描述以上装置是以功能分为各种单元/模块分别描述。当然,在实施本发明时可以把各单元/模块的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, the above apparatus is described by dividing the functions into various units/modules. Of course, when implementing the present invention, the functions of each unit/module may be implemented in one or more software and/or hardware.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random AccessMemory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. During execution, the processes of the embodiments of the above-mentioned methods may be included. The storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM) or the like.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical scope disclosed by the present invention can easily think of changes or substitutions. All should be included within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims (10)

CN202010497880.3A2020-06-032020-06-03 An instant message transmission method, device, electronic device and storage mediumPendingCN111726280A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202010497880.3ACN111726280A (en)2020-06-032020-06-03 An instant message transmission method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202010497880.3ACN111726280A (en)2020-06-032020-06-03 An instant message transmission method, device, electronic device and storage medium

Publications (1)

Publication NumberPublication Date
CN111726280Atrue CN111726280A (en)2020-09-29

Family

ID=72565782

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202010497880.3APendingCN111726280A (en)2020-06-032020-06-03 An instant message transmission method, device, electronic device and storage medium

Country Status (1)

CountryLink
CN (1)CN111726280A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113810264A (en)*2021-01-152021-12-17北京京东拓先科技有限公司Information transmission method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20120072508A1 (en)*2007-01-192012-03-22Synchronica PlcMedia instant messaging for mobile device
CN108023807A (en)*2017-11-022018-05-11东软集团股份有限公司Instant communicating method, server and message-oriented middleware
CN108600085A (en)*2018-04-042018-09-28腾讯科技(深圳)有限公司Message is sent and output method, device, server, terminal and storage medium
CN108712332A (en)*2018-05-172018-10-26华为技术有限公司 A communication method, system and device
CN109067910A (en)*2018-09-132018-12-21乐蜜有限公司A kind of method and device that message pulls

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20120072508A1 (en)*2007-01-192012-03-22Synchronica PlcMedia instant messaging for mobile device
CN108023807A (en)*2017-11-022018-05-11东软集团股份有限公司Instant communicating method, server and message-oriented middleware
CN108600085A (en)*2018-04-042018-09-28腾讯科技(深圳)有限公司Message is sent and output method, device, server, terminal and storage medium
CN108712332A (en)*2018-05-172018-10-26华为技术有限公司 A communication method, system and device
CN109067910A (en)*2018-09-132018-12-21乐蜜有限公司A kind of method and device that message pulls

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113810264A (en)*2021-01-152021-12-17北京京东拓先科技有限公司Information transmission method and device, electronic equipment and storage medium

Similar Documents

PublicationPublication DateTitle
CN106357517B (en)Directional label generation method and device
US11057484B2 (en)Message push notification client improvements for multi-user devices
US9578081B2 (en)System and method for providing an actively invalidated client-side network resource cache
US8799400B2 (en)System and method for managing multiple queues of non-persistent messages in a networked environment
US9110884B2 (en)Message publishing and subscribing method and apparatus
JP2010533906A (en) Method, system and apparatus for sorting topics within a group
CN107251086A (en) App Service Delivery via App Service Standalone
CN106713323B (en)page content preview method, client, server and system
CN103457828B (en)The instant communication method and system of a kind of inter-network
CN109446204B (en)Data storage method and device for instant messaging, electronic equipment and medium
CN112311656B (en)Message aggregation and display method and device, electronic equipment and computer readable medium
CN106470150B (en)Relation chain storage method and device
CN108206742B (en)Message sending method, device, server and system
KR20180118732A (en) Managing multiple profiles for a single account in an asynchronous messaging system
CN106100974B (en)Information sharing method and device
WO2018133824A1 (en)Content sharing method and device
CN104135429B (en)A kind of information-pushing method and device
CN110247739A (en)A kind of method for message transmission and device
WO2014000493A1 (en)Method and apparatus for routing a message
JP2023527060A (en) Mail processing method, device, device and medium
CN106411713B (en)State notification method and server
CN111726280A (en) An instant message transmission method, device, electronic device and storage medium
CN105376147B (en)Instant communication information route addressing method, access server and system
KR101545663B1 (en)Device, system and method for changing multi-user relationship chain
CN116996421B (en)Network quality detection method and related equipment

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
TA01Transfer of patent application right

Effective date of registration:20210602

Address after:25, 5th floor, shuangjingfang office building, 3 frisha street, 189352, Singapore

Applicant after:Zhuomi Private Ltd.

Address before:Room 1101, Santai Commercial Building, 139 Connaught Road, Hong Kong, China

Applicant before:HONG KONG LIVE.ME Corp.,Ltd.

TA01Transfer of patent application right
RJ01Rejection of invention patent application after publication

Application publication date:20200929

RJ01Rejection of invention patent application after publication

[8]ページ先頭

©2009-2025 Movatter.jp