CN105657000A - Message transmission method and device - Google Patents
Message transmission method and device Download PDFInfo
- Publication number
- CN105657000A CN105657000A CN201510997618.4A CN201510997618A CN105657000A CN 105657000 A CN105657000 A CN 105657000A CN 201510997618 A CN201510997618 A CN 201510997618A CN 105657000 A CN105657000 A CN 105657000A
- Authority
- CN
- China
- Prior art keywords
- message
- network
- client
- client terminal
- data packet
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 58
- 230000005540 biological transmission Effects 0.000 title abstract description 28
- 238000012545 processing Methods 0.000 claims abstract description 12
- 238000004891 communication Methods 0.000 claims description 85
- 230000008859 change Effects 0.000 claims description 13
- 238000013507 mapping Methods 0.000 claims description 10
- 238000012546 transfer Methods 0.000 claims 2
- 239000002699 waste material Substances 0.000 abstract description 5
- 230000008569 process Effects 0.000 description 7
- 238000012790 confirmation Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 3
- 238000004590 computer program Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 238000000429 assembly Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/55—Push-based network services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/04—Real-time or near real-time messaging, e.g. instant messaging [IM]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/21—Monitoring or handling of messages
- H04L51/226—Delivery according to priorities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明公开了一种消息传送方法及装置,其中,该方法包括:在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列;在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端。通过本发明的技术方案能够避免当客户端所在终端在较长时间内一直处于断网状态时,服务器重复进行消息推送导致的资源和带宽的占用,有效地降低对服务器的处理资源和带宽的浪费。
The present invention discloses a message transmission method and device, wherein the method includes: when pushing the message data packet of the message queue to the client fails, putting the message data packet back into the message queue; When the client sends a connection request, the message data packet is taken out from the message queue, and the taken out message data packet is pushed to the client. Through the technical solution of the present invention, when the terminal where the client is located has been disconnected from the network for a long period of time, the occupation of resources and bandwidth caused by the server repeatedly pushing messages can be avoided, and the waste of processing resources and bandwidth of the server can be effectively reduced .
Description
技术领域technical field
本发明涉及通信技术领域,特别涉及一种消息传送方法及装置。The present invention relates to the field of communication technology, in particular to a message transmission method and device.
背景技术Background technique
客户端(Client)是指与服务器相对应,为客户提供本地服务的应用程序。除了一些只在本地运行的应用程序之外,一般安装在普通的终端上,需要与服务器互相配合运行。The client (Client) refers to an application program that corresponds to a server and provides local services for clients. Except for some applications that only run locally, they are generally installed on ordinary terminals and need to cooperate with the server to run.
在服务器向客户端发送新的消息时,通常是采用推送(push)的方式,也就是服务器主动向客户端推送消息,但客户端所在终端的网络状态由于环境的变化也会动态变化,例如,服务器在向客户端推送消息时,客户端所在终端的网络状态变化,处于断网状态,无法正常接收,此时,服务器通常是每隔一段时间就重新将消息推送一次,但客户端所在终端可能在较长时间内一直处于断网状态,浪费了服务器的处理资源和带宽。When the server sends a new message to the client, it usually uses a push method, that is, the server actively pushes the message to the client, but the network status of the terminal where the client is located will also change dynamically due to changes in the environment, for example, When the server pushes the message to the client, the network status of the terminal where the client is located changes, the network is disconnected, and cannot be received normally. At this time, the server usually pushes the message again every once in a while, but the terminal where the client is located may The network has been disconnected for a long time, wasting the processing resources and bandwidth of the server.
发明内容Contents of the invention
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决或者减缓上述问题的消息传送方法及装置,在实现消息数据的推送过程中,有效地降低对服务器的处理资源和带宽的占用。In view of the above problems, the present invention is proposed to provide a message transmission method and device that overcomes the above problems or at least partly solves or alleviates the above problems, and effectively reduces the processing resources and bandwidth of the server during the process of pushing message data occupancy.
根据本发明的一个方面,提供了一种消息传送方法,所述方法包括:According to one aspect of the present invention, a message transmission method is provided, the method comprising:
在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列;When the message data packet of the message queue fails to be pushed to the client, the message data packet is put back into the message queue;
在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端。When the connection request sent by the client is obtained, the message data packet is taken out from the message queue, and the taken out message data packet is pushed to the client.
可选地,所述连接请求中包括所述客户端接入通信网络的网络类型标识;Optionally, the connection request includes a network type identification of the communication network accessed by the client;
相应地,所述将取出的消息数据包推送至所述客户端,具体包括:Correspondingly, the pushing the retrieved message data packet to the client specifically includes:
根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化,若未变化,则将取出的消息数据包推送至所述客户端。According to the network type identifier, it is judged whether the communication network accessed by the client has changed compared with that before the push failure, and if there is no change, the fetched message data packet is pushed to the client.
可选地,所述根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化,具体包括:Optionally, the judging according to the network type identifier whether the communication network accessed by the client has changed compared with before the push failure, specifically includes:
判断所述网络类型标识与预存类型标识是否相同;judging whether the network type identifier is the same as the pre-stored type identifier;
若相同,则认定所述客户端接入的通信网络未变化;If they are the same, it is determined that the communication network accessed by the client has not changed;
若不相同,则认定所述客户端接入的通信网络变化,并将所述网络类型标识作为预存类型标识。If not, it is determined that the communication network accessed by the client has changed, and the network type identifier is used as the pre-stored type identifier.
可选地,所述根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化之后,所述方法还包括:Optionally, after judging according to the network type identifier whether the communication network accessed by the client has changed compared with before the push failure, the method further includes:
若变化,则根据所述网络类型标识查找映射关系,获得与所述网络类型标识对应的通信网络,将取出的消息数据包通过查找获得的通信网络推送至所述客户端。If it changes, look up the mapping relationship according to the network type identifier, obtain the communication network corresponding to the network type identifier, and push the retrieved message data packet to the client through the communication network obtained through the search.
可选地,所述在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列之前,所述方法还包括:Optionally, when pushing the message data packet of the message queue to the client fails, before putting the message data packet back into the message queue, the method further includes:
将消息队列的消息数据包向客户端进行推送,在预设时间内未收到所述客户端返回的确定字符时,认定向所述客户端推送消息失败。Pushing the message data packet of the message queue to the client, if no confirm character returned by the client is received within a preset time, it is determined that the push of the message to the client fails.
可选地,所述消息数据包中包括:消息类型和/或时间戳;Optionally, the message data packet includes: message type and/or timestamp;
相应地,所述从所述消息队列中取出消息数据包,具体包括:Correspondingly, the taking out the message data packet from the message queue specifically includes:
根据所述消息数据包中的消息类型和/或时间戳从所述消息队列中取出消息数据包。The message data packet is taken out from the message queue according to the message type and/or the time stamp in the message data packet.
根据本发明的另一个方面,提供了一种消息传送装置,所述装置包括:According to another aspect of the present invention, a messaging device is provided, the device comprising:
处理单元,适于在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列;The processing unit is adapted to put the message data packet back into the message queue when pushing the message data packet of the message queue to the client fails;
推送单元,适于在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端。The push unit is adapted to take out a message data packet from the message queue when obtaining the connection request sent by the client, and push the taken out message data packet to the client.
可选地,所述连接请求中包括所述客户端接入通信网络的网络类型标识;Optionally, the connection request includes a network type identification of the communication network accessed by the client;
相应地,所述推送单元,具体包括:Correspondingly, the push unit specifically includes:
判断模块,适于根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化;The judging module is adapted to judge whether the communication network accessed by the client has changed compared with that before the push failure according to the network type identifier;
推送模块,适于当所述判断模块的判断结果为所述客户端接入的通信网络与推送失败前相比未变化时,将取出的消息数据包推送至所述客户端。The push module is adapted to push the retrieved message data packet to the client when the judging result of the judging module is that the communication network accessed by the client has not changed compared with that before the push failure.
可选地,所述判断模块,具体适于判断所述网络类型标识与预存类型标识是否相同,若相同,则认定所述客户端接入的通信网络未变化,若不相同,则认定所述客户端接入的通信网络变化,并将所述网络类型标识作为预存类型标识。Optionally, the judging module is specifically adapted to judge whether the network type identifier is the same as the pre-stored type identifier, if they are the same, it is determined that the communication network accessed by the client has not changed, and if they are not the same, it is determined that the The communication network accessed by the client changes, and the network type identifier is used as the pre-stored type identifier.
可选地,所述推送模块,还适于当所述判断模块的判断结果为所述客户端接入的通信网络与推送失败前相比发生变化时,根据所述网络类型标识查找映射关系,获得与所述网络类型标识对应的通信网络,将取出的消息数据包通过查找获得的通信网络推送至所述客户端。Optionally, the push module is further adapted to search for a mapping relationship according to the network type identifier when the judging result of the judging module is that the communication network accessed by the client has changed compared with that before the push failure, The communication network corresponding to the network type identifier is obtained, and the retrieved message data packet is pushed to the client through the communication network obtained by searching.
可选地,所述推送单元,还适于在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列之前,将消息队列的消息数据包向客户端进行推送,在预设时间内未收到所述客户端返回的确定字符时,认定向所述客户端推送消息失败。Optionally, the push unit is further adapted to push the message data packets of the message queue to the client before re-putting the message data packets into the message queue when the push of the message data packets of the message queue to the client fails. Pushing is performed, and when no confirmation character returned by the client is received within a preset time, it is determined that the push of the message to the client fails.
可选地,所述消息数据包中包括:消息类型和/或时间戳;Optionally, the message data packet includes: message type and/or timestamp;
相应地,所述推送单元,具体适于根据所述消息数据包中的消息类型和/或时间戳从所述消息队列中取出消息数据包。Correspondingly, the push unit is specifically adapted to take out the message data packet from the message queue according to the message type and/or the time stamp in the message data packet.
本发明的有益效果为:The beneficial effects of the present invention are:
本发明提出的消息传送方法及装置,通过在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列;在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端,避免当客户端所在终端在较长时间内一直处于断网状态时,服务器重复进行消息推送导致的资源和带宽的占用,进而在消息数据推送过程中,有效地降低对服务器的处理资源和带宽的浪费。In the message transmission method and device proposed by the present invention, when the message data packet of the message queue fails to be pushed to the client, the message data packet is put back into the message queue; when the connection request sent by the client is obtained , take out the message data packet from the message queue, and push the taken out message data packet to the client, so as to avoid the problem caused by the server repeatedly pushing the message when the terminal where the client is located has been disconnected from the network for a long time The occupancy of resources and bandwidth, and then effectively reduce the waste of server processing resources and bandwidth during the message data push process.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the specific embodiments of the present invention are enumerated below.
附图说明Description of drawings
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same parts. In the attached picture:
图1示意性示出了本发明一个实施例的消息传送方法的流程示意图;FIG. 1 schematically shows a schematic flowchart of a message transmission method according to an embodiment of the present invention;
图2示意性示出了本发明另一实施例的消息传送方法的流程示意图;FIG. 2 schematically shows a schematic flowchart of a message transmission method according to another embodiment of the present invention;
图3示意性示出了本发明另一实施例的消息传送方法中步骤S22的细分流程示意图;FIG. 3 schematically shows a subdivided flowchart of step S22 in a message transmission method according to another embodiment of the present invention;
图4示意性示出了本发明另一实施例的消息传送方法的流程示意图;FIG. 4 schematically shows a schematic flowchart of a message transmission method according to another embodiment of the present invention;
图5示意性示出了本发明一个实施例的消息传送装置的结构示意图。Fig. 5 schematically shows a schematic structural diagram of a message transmission device according to an embodiment of the present invention.
具体实施方式detailed description
下面详细描述本发明的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本发明,而不能解释为对本发明的限制。Embodiments of the present invention are described in detail below, examples of which are shown in the drawings, wherein the same or similar reference numerals designate the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the figures are exemplary only for explaining the present invention and should not be construed as limiting the present invention.
本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本发明的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。Those skilled in the art will understand that unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the word "comprising" used in the description of the present invention refers to the presence of said features, integers, steps, operations, elements and/or components, but does not exclude the presence or addition of one or more other features, Integers, steps, operations, elements, components, and/or groups thereof.
本技术领域技术人员可以理解,除非另外定义,这里使用的所有术语(包括技术术语和科学术语),具有与本发明所属领域中的普通技术人员的一般理解相同的意义。还应该理解的是,诸如通用字典中定义的那些术语,应该被理解为具有与现有技术的上下文中的意义一致的意义,并且除非被特定定义,否则不会用理想化或过于正式的含义来解释。Those skilled in the art can understand that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art to which this invention belongs. It should also be understood that terms, such as those defined in commonly used dictionaries, should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be used in an idealized or overly formal sense unless specifically defined to explain.
图1示意性示出了本发明一个实施例的消息传送方法的流程示意图;FIG. 1 schematically shows a schematic flowchart of a message transmission method according to an embodiment of the present invention;
参照图1,本发明实施例的消息传送方法具体包括以下步骤:Referring to Fig. 1, the message transmission method of the embodiment of the present invention specifically includes the following steps:
S11、在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列。S11. When pushing the message data packet of the message queue to the client fails, re-put the message data packet into the message queue.
需要说明的是,本实施例中的消息数据包括但不限于即时通讯消息数据、一般通讯消息数据等。相应的,消息队列是指用于存放所述即时通讯消息数据和一般通讯消息数据的队列。It should be noted that the message data in this embodiment includes, but is not limited to, instant messaging message data, general messaging message data, and the like. Correspondingly, the message queue refers to a queue for storing the instant messaging message data and general messaging message data.
具体的,即时通讯消息指定了接收该即时通讯消息的用户标识。即时通讯消息可以是来自该用户的好友所在终端所发送的即时通讯消息,或者是该用户所在工作群或讨论组中的成员所在终端发出的即时通讯消息。该即时通讯消息的形式可以是文字消息、图片消息、语音消息或视频消息等,由即时通讯中的即时通讯服务器进行接收。一般通讯消息是指客户端的一般推送消息或系统推送消息等。Specifically, the instant messaging message specifies the ID of the user receiving the instant messaging message. The instant messaging message may be an instant messaging message sent from a terminal of a friend of the user, or an instant messaging message sent from a terminal of a member of the user's work group or discussion group. The form of the instant messaging message may be a text message, a picture message, a voice message or a video message, etc., and is received by the instant messaging server in the instant messaging. The general communication message refers to a general push message or a system push message of the client, and the like.
本步骤中,服务端将消息队列的消息数据包向客户端推送后,若确定推送失败,则将所述消息数据包重新放入消息队列,服务器不再重复向客户端推送该消息数据包,以避免客户端所在终端在较长时间内一直处于断网状态时,造成对服务器资源和带宽的占用。In this step, after the server pushes the message data packet of the message queue to the client, if it is determined that the push fails, the message data packet is put back into the message queue, and the server no longer repeatedly pushes the message data packet to the client, In order to avoid the occupation of server resources and bandwidth when the terminal where the client is located has been disconnected from the network for a long period of time.
可理解的是,实现确定推送失败包括多种实现方式,如接收到客户端反馈的接收失败响应消息,或,预设时间长度内没有接收到客户端反馈的接收成功响应消息等,本领域技术人员需要根据实际应用进行设置,对此本发明实施例不作具体限定。It can be understood that the implementation of determining push failure includes multiple implementation methods, such as receiving a reception failure response message fed back by the client, or receiving a successful reception response message fed back by the client within a preset period of time, etc. Personnel need to set according to the actual application, which is not specifically limited in this embodiment of the present invention.
S12、在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端。S12. When the connection request sent by the client is obtained, take out a message data packet from the message queue, and push the taken out message data packet to the client.
在实际应用中,当获取到所述客户端发送的连接请求时,则再次从所述消息队列中取出之前向所述客户端推送的消息数据包,将取出的消息数据包推送再次推送给所述客户端。In practical applications, when the connection request sent by the client is obtained, the message data packet previously pushed to the client is taken out from the message queue again, and the taken out message data packet is pushed to the client.
在一个具体实施例中,如用户进入停车场、地下室或电梯等网络信号较弱的地方时,客户端所在终端的网络状态变化,处于断网状态,无法正常接收服务端推送的消息数据包,此时,服务器不在每隔一段时间就重新将消息推送一次,直到客户端重新连接到网络时,客户端会主动向服务端发送连接请求,在服务端获取到所述客户端发送的连接请求时,再从所述消息队列中取出消息数据包,并将取出的消息数据包推送至所述客户端。In a specific embodiment, if the user enters a place with a weak network signal such as a parking lot, a basement, or an elevator, the network status of the terminal where the client is located changes and is in a disconnected state, unable to normally receive the message data packet pushed by the server. At this time, the server does not push the message again every once in a while, until the client reconnects to the network, the client will actively send a connection request to the server, and when the server obtains the connection request sent by the client , and then take out the message data packet from the message queue, and push the taken out message data packet to the client.
本发明实施例提出的消息传送方法,通过在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列;在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端,避免当客户端所在终端在较长时间内一直处于断网状态时,服务器重复进行消息推送导致的资源和带宽的占用,进而在消息数据推送过程中,有效地降低对服务器的处理资源和带宽的浪费。In the message transmission method proposed by the embodiment of the present invention, when the message data packet of the message queue fails to be pushed to the client, the message data packet is put back into the message queue; when the connection request sent by the client is obtained , take out the message data packet from the message queue, and push the taken out message data packet to the client, so as to avoid the problem caused by the server repeatedly pushing the message when the terminal where the client is located has been disconnected from the network for a long time The occupancy of resources and bandwidth, and then effectively reduce the waste of server processing resources and bandwidth during the message data push process.
图2示意性示出了本发明另一实施例的消息传送方法的流程示意图;FIG. 2 schematically shows a schematic flowchart of a message transmission method according to another embodiment of the present invention;
参照图2,本发明实施例的消息传送方法具体包括以下步骤:Referring to Figure 2, the message transmission method of the embodiment of the present invention specifically includes the following steps:
S21、在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列。S21. When pushing the message data packet of the message queue to the client fails, put the message data packet into the message queue again.
其中,连接请求中包括所述客户端接入通信网络的网络类型标识。Wherein, the connection request includes the identifier of the network type of the communication network accessed by the client.
步骤S21与图1所示的实施方式的步骤S11相同,在此不再赘述。Step S21 is the same as step S11 in the embodiment shown in FIG. 1 , and will not be repeated here.
S22、在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化,若未变化,则将取出的消息数据包推送至所述客户端。S22. When the connection request sent by the client is obtained, take out the message data packet from the message queue, and judge whether the communication network accessed by the client has changed compared with that before the push failure according to the network type identifier , if there is no change, push the retrieved message data packet to the client.
需要说明的是,客户端接入通信网络的网络类型主要有多种,如wifi、net等,其中,net网络类型包括如2G、3G、4G等具体网络类型。具体的,wifi、net网络都支持长连接。It should be noted that there are mainly multiple network types for the client to access the communication network, such as wifi, net, etc., wherein the net network type includes specific network types such as 2G, 3G, and 4G. Specifically, both wifi and net networks support long connections.
在实际应用中,当手机网络类型为wifi、net时,客户端与服务端之间的网络链路连接为长连接,服务端可直接将取出的消息数据包推送至所述客户端。In practical applications, when the mobile phone network type is wifi or net, the network link connection between the client and the server is a long connection, and the server can directly push the retrieved message data packet to the client.
具体的,根据客户端接入通信网络的网络类型的不同,服务端向客户端推送消息的网络链路连接也不同。因此,在获取到客户端发送的连接请求时,需要根据连接请求中包括的客户端接入通信网络的网络类型标识确定所述客户端接入的通信网络与推送失败前相比是否变化,若未变化,且客户端接入的通信网络与推送失败前对应的网络类型为wifi或net时,则服务端可直接将取出的消息数据包推送至所述客户端。Specifically, according to the different types of networks through which the client accesses the communication network, the network link connections through which the server pushes messages to the client are also different. Therefore, when obtaining the connection request sent by the client, it is necessary to determine whether the communication network accessed by the client has changed compared with that before the push failure according to the network type identifier of the client access communication network included in the connection request. If there is no change, and the communication network accessed by the client is of wifi or net corresponding to the network type before the push failure, the server can directly push the retrieved message data packet to the client.
本发明实施例,通过从客户端发送的连接请求中获取的网络类型标识,判断所述客户端接入的通信网络与推送失败前相比是否变化,并在确认客户端接入的通信网络前后没有变化时,直接将取出的消息数据包推送至所述客户端。以避免当客户端接入的通信网络发生变化时,由于没有及时对传送消息数据包的方式,或消息数据包的数据格式进行修改而造成的消息传送失败,以确保消息数据包的正常传送。In the embodiment of the present invention, through the network type identifier obtained from the connection request sent by the client, it is judged whether the communication network accessed by the client has changed compared with that before the push failure, and before and after confirming the communication network accessed by the client When there is no change, directly push the retrieved message data packet to the client. To avoid message transmission failure caused by not timely modifying the way of transmitting the message data packet or the data format of the message data packet when the communication network accessed by the client changes, so as to ensure the normal transmission of the message data packet.
在本发明的一个可选实施例中,如图3所示,步骤S22中的根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化,具体包括以下步骤:In an optional embodiment of the present invention, as shown in FIG. 3 , in step S22, according to the network type identifier, judging whether the communication network accessed by the client has changed compared with that before the push failure, specifically includes the following steps :
S220、获取所述网络类型标识;S220. Obtain the network type identifier;
S221、判断所述网络类型标识与预存类型标识是否相同,若相同则执行步骤S222,若不相同,则执行步骤S223;S221. Determine whether the network type identifier is the same as the pre-stored type identifier, if they are the same, execute step S222, if not, execute step S223;
S222、认定所述客户端接入的通信网络未变化;S222. Determine that the communication network accessed by the client has not changed;
S223、认定所述客户端接入的通信网络变化,并将所述网络类型标识作为预存类型标识。S223. Determine that the communication network accessed by the client has changed, and use the network type identifier as a pre-stored type identifier.
需要说明的是,所述预存类型标识,为上一次进行网络接入时,客户端发送的连接请求中携带的网络类型标识。It should be noted that the pre-stored type identifier is the network type identifier carried in the connection request sent by the client during the last network access.
本发明实施例中,具体通过判断所述网络类型标识与预存类型标识是否相同,若当前接入的网络类型标识与预存类型标识相同,则认定所述客户端接入的通信网络未变化,若当前接入的网络类型标识与预存类型标识不同,认定所述客户端接入的通信网络变化,并将所述网络类型标识作为新的预存类型标识,并替换之前的预存类型标识。进而保证客户端接入的通信网络判别的准确性。In the embodiment of the present invention, specifically by judging whether the network type identifier is the same as the pre-stored type identifier, if the currently accessed network type identifier is the same as the pre-stored type identifier, it is determined that the communication network accessed by the client has not changed. The currently accessed network type identifier is different from the pre-stored type identifier, it is determined that the communication network accessed by the client has changed, and the network type identifier is used as a new pre-stored type identifier, and the previous pre-stored type identifier is replaced. Thus, the accuracy of the communication network that the client accesses is determined is ensured.
在本发明的一个可选实施例中,步骤S22中的根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化之后,所述方法还包括以下附图中未示出的步骤S23:In an optional embodiment of the present invention, after judging in step S22 according to the network type identifier whether the communication network accessed by the client has changed compared with that before the push failure, the method further includes the following steps in the accompanying drawings: Step S23 not shown:
S23、当所述客户端接入的通信网络与推送失败前相比发生变化时,根据所述网络类型标识查找映射关系,获得与所述网络类型标识对应的通信网络,将取出的消息数据包通过查找获得的通信网络推送至所述客户端。S23. When the communication network accessed by the client changes compared with that before the push failure, look up the mapping relationship according to the network type identifier, obtain the communication network corresponding to the network type identifier, and take out the message data packet The communication network obtained through searching is pushed to the client.
需要说明的是,所述映射关系为预先设置的记载有网络类型标识与通信网络之间的对应关系。It should be noted that the mapping relationship is a preset relationship that records the correspondence between the network type identifier and the communication network.
本发明实施例,通过从客户端发送的连接请求中获取的网络类型标识,判断所述客户端接入的通信网络与推送失败前相比是否变化,并在确认客户端接入的通信网络前后发生变化时,根据所述网络类型标识查找映射关系,获得与所述网络类型标识对应的通信网络,将取出的消息数据包通过查找获得的通信网络推送至所述客户端。进一步避免了当客户端接入的通信网络发生变化时,由于没有及时对传送消息数据包的方式,或消息数据包的数据格式进行修改而造成的消息传送失败,以确保消息数据包的正常传送。In the embodiment of the present invention, through the network type identifier obtained from the connection request sent by the client, it is judged whether the communication network accessed by the client has changed compared with that before the push failure, and before and after confirming the communication network accessed by the client When a change occurs, look up the mapping relationship according to the network type identifier, obtain the communication network corresponding to the network type identifier, and push the retrieved message data packet to the client through the communication network obtained through the search. Further avoid the failure of message transmission caused by not timely modifying the way of transmitting message data packets or the data format of message data packets when the communication network accessed by the client changes, so as to ensure the normal transmission of message data packets .
图4示意性示出了本发明另一实施例的消息传送方法的流程示意图;FIG. 4 schematically shows a schematic flowchart of a message transmission method according to another embodiment of the present invention;
参照图4,本发明实施例的消息传送方法具体包括以下步骤:Referring to Figure 4, the message transmission method of the embodiment of the present invention specifically includes the following steps:
S41、将消息队列的消息数据包向客户端进行推送,在预设时间内未收到所述客户端返回的确定字符时,认定向所述客户端推送消息失败。S41. Push the message data packet of the message queue to the client, and if no confirmation character returned by the client is received within a preset time, it is determined that pushing the message to the client fails.
S42、在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列。S42. When pushing the message data packet of the message queue to the client fails, re-put the message data packet into the message queue.
其中,连接请求中包括所述客户端接入通信网络的网络类型标识。Wherein, the connection request includes the identifier of the network type of the communication network accessed by the client.
S43、在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端。S43. When the connection request sent by the client is obtained, take out the message data packet from the message queue, and push the taken out message data packet to the client.
步骤S42~S43与图1所示的实施方式的步骤S11~S12相同,在此不再赘述。Steps S42-S43 are the same as steps S11-S12 in the embodiment shown in FIG. 1 , and will not be repeated here.
本发明实施例,当服务端有需要进行消息推送的消息数据包时,将消息队列的消息数据包向客户端进行推送,并通过确认在预设时间内是否收到所述客户端返回的确定字符的饭方式,实现向所述终端推送消息失败的认定。本发明实施例能够准确地实现对消息推送失败的认定,进而保证下一次消息数据包的正常传送。In the embodiment of the present invention, when the server has a message data packet that needs to be pushed, it pushes the message data packet of the message queue to the client, and confirms whether the client returns within a preset time. Characters are used to determine the failure of pushing messages to the terminal. The embodiment of the present invention can accurately realize the identification of message push failure, thereby ensuring the normal transmission of the next message data packet.
在本发明的一个可选实施例中,所述消息数据包中包括:消息类型和/或时间戳;In an optional embodiment of the present invention, the message data packet includes: message type and/or time stamp;
相应地,所述从所述消息队列中取出消息数据包,具体包括:根据所述消息数据包中的消息类型和/或时间戳从所述消息队列中取出消息数据包。Correspondingly, the taking out the message data packet from the message queue specifically includes: taking out the message data packet from the message queue according to the message type and/or the time stamp in the message data packet.
本发明实施例,在从所述消息队列中取出消息数据包时,根据消息数据包中的消息类型和/或从所述消息队列中取出消息数据包,进而保证即时消息数据对应的消息数据包优先于一般推送消息对应的消息数据包被重新推送给客户端,进一步地,对于同一优先级的消息数据包,根据消息数据包中的时间戳,优先选取时间较早的消息数据包进行重新推送,以减小对客户端对应用户造成的影响和损失,保证用户利益,提升用户体验。In the embodiment of the present invention, when taking out the message data packet from the message queue, according to the message type in the message data packet and/or taking out the message data packet from the message queue, and then ensuring that the message data packet corresponding to the instant message data The message data packets corresponding to the priority push messages are re-pushed to the client. Further, for the message data packets of the same priority, according to the timestamp in the message data packets, the message data packets with an earlier time are preferentially selected for re-push , so as to reduce the impact and loss on the corresponding users of the client, ensure the interests of users, and improve user experience.
对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明实施例并不受所描述的动作顺序的限制,因为依据本发明实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本发明实施例所必须的。For the method embodiment, for the sake of simple description, it is expressed as a series of action combinations, but those skilled in the art should know that the embodiment of the present invention is not limited by the described action order, because according to the embodiment of the present invention , certain steps may be performed in other order or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
图5示意性示出了本发明一个实施例的消息传送装置的结构示意图。Fig. 5 schematically shows a schematic structural diagram of a message transmission device according to an embodiment of the present invention.
参照图5,本发明实施例的消息传送装置具体包括处理单元501和推送单元502,其中:Referring to FIG. 5 , the message transmission device according to the embodiment of the present invention specifically includes a processing unit 501 and a push unit 502, wherein:
所述的处理单元501,适于在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列;The processing unit 501 is adapted to re-put the message data packet into the message queue when pushing the message data packet of the message queue to the client fails;
所述的推送单元502,适于在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端。The push unit 502 is adapted to take out a message data packet from the message queue when obtaining the connection request sent by the client, and push the taken out message data packet to the client.
本发明实施例提出的消息传送装置,通过在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列;在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端,避免当客户端所在终端在较长时间内一直处于断网状态时,服务器重复进行消息推送导致的资源和带宽的占用,进而在消息数据推送过程中,有效地降低对服务器的处理资源和带宽的浪费。The message transmission device proposed by the embodiment of the present invention re-puts the message data packet into the message queue when the message data packet of the message queue fails to be pushed to the client; when the connection request sent by the client is obtained , take out the message data packet from the message queue, and push the taken out message data packet to the client, so as to avoid the problem caused by the server repeatedly pushing the message when the terminal where the client is located has been disconnected from the network for a long time The occupancy of resources and bandwidth, and then effectively reduce the waste of server processing resources and bandwidth during the message data push process.
根据本发明的一个可选实施例,所述连接请求中包括所述客户端接入通信网络的网络类型标识;According to an optional embodiment of the present invention, the connection request includes a network type identifier of the communication network accessed by the client;
相应地,所述推送单元,具体包括:Correspondingly, the push unit specifically includes:
判断模块,适于根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化;The judging module is adapted to judge whether the communication network accessed by the client has changed compared with that before the push failure according to the network type identifier;
推送模块,适于当所述判断模块的判断结果为所述客户端接入的通信网络与推送失败前相比未变化时,将取出的消息数据包推送至所述客户端。The push module is adapted to push the retrieved message data packet to the client when the judging result of the judging module is that the communication network accessed by the client has not changed compared with that before the push failure.
根据本发明的一个可选实施例,所述判断模块,具体适于判断所述网络类型标识与预存类型标识是否相同,若相同,则认定所述客户端接入的通信网络未变化,若不相同,则认定所述客户端接入的通信网络变化,并将所述网络类型标识作为预存类型标识。According to an optional embodiment of the present invention, the judging module is specifically adapted to judge whether the network type identifier is the same as the pre-stored type identifier, if they are the same, it is determined that the communication network accessed by the client has not changed, if not If they are the same, it is determined that the communication network accessed by the client has changed, and the network type identifier is used as the pre-stored type identifier.
根据本发明的一个可选实施例,所述推送模块,还适于当所述判断模块的判断结果为所述客户端接入的通信网络与推送失败前相比发生变化时,根据所述网络类型标识查找映射关系,获得与所述网络类型标识对应的通信网络,将取出的消息数据包通过查找获得的通信网络推送至所述客户端。According to an optional embodiment of the present invention, the push module is further adapted to: when the judging result of the judging module is that the communication network accessed by the client has changed compared with that before the push failure, according to the network The type identifier looks up the mapping relationship, obtains the communication network corresponding to the network type identifier, and pushes the retrieved message data packet to the client through the communication network obtained through the search.
根据本发明的一个可选实施例,所述推送单元,还适于在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列之前,将消息队列的消息数据包向客户端进行推送,在预设时间内未收到所述客户端返回的确定字符时,认定向所述终端推送消息失败。According to an optional embodiment of the present invention, the push unit is further adapted to push the message data packet of the message queue to the client before re-putting the message data packet into the message queue when the message data packet of the message queue fails to be pushed to the client. The message data packet is pushed to the client, and if no confirmation character returned by the client is received within a preset time, it is determined that the push of the message to the terminal fails.
根据本发明的一个可选实施例,所述消息数据包中包括:消息类型和/或时间戳;According to an optional embodiment of the present invention, the message data packet includes: message type and/or time stamp;
相应地,所述推送单元,具体适于根据所述消息数据包中的消息类型和/或时间戳从所述消息队列中取出消息数据包。Correspondingly, the push unit is specifically adapted to take out the message data packet from the message queue according to the message type and/or the time stamp in the message data packet.
对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment.
综上所述,本发明实施例提出的消息传送方法及装置,通过在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列;在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端,避免当客户端所在终端在较长时间内一直处于断网状态时,服务器重复进行消息推送导致的资源和带宽的占用,进而在消息数据推送过程中,有效地降低对服务器的处理资源和带宽的浪费。To sum up, the message transmission method and device proposed by the embodiments of the present invention re-put the message data packet into the message queue when the message data packet of the message queue fails to be pushed to the client; When the connection request sent by the client, the message data packet is taken out from the message queue, and the taken out message data packet is pushed to the client, so as to avoid that when the terminal where the client is located has been disconnected from the network for a long time, The resource and bandwidth occupation caused by repeated message push by the server can effectively reduce the waste of server processing resources and bandwidth during the process of message data push.
应当注意,在此提供的算法和公式不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示例一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。It should be noted that the algorithms and formulas presented herein are not inherently related to any particular computer, virtual system, or other device. Various general systems can also be used with the examples based here. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.
类似地,应当理解,为了精简本发明并帮助理解本发明各个方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法和装置解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如权利要求书所反映,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline the present invention and to facilitate an understanding of one or more of its various aspects, various features of the invention are sometimes grouped together into a single embodiment , figure, or description of it. This disclosed method and apparatus, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method or method so disclosed may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的网站安全检测设备中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in the website security detection device according to the embodiment of the present invention. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.
以上所述仅是本发明的部分实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above descriptions are only part of the embodiments of the present invention. It should be pointed out that those skilled in the art can make some improvements and modifications without departing from the principles of the present invention. It should be regarded as the protection scope of the present invention.
本发明公开了A1、一种消息传送方法,包括:The invention discloses A1. A message transmission method, comprising:
在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列;When the message data packet of the message queue fails to be pushed to the client, the message data packet is put back into the message queue;
在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端。When the connection request sent by the client is obtained, the message data packet is taken out from the message queue, and the taken out message data packet is pushed to the client.
A2、如A1所述的方法,所述连接请求中包括所述客户端接入通信网络的网络类型标识;A2. The method as described in A1, wherein the connection request includes the network type identification of the client accessing the communication network;
相应地,所述将取出的消息数据包推送至所述客户端,具体包括:Correspondingly, the pushing the retrieved message data package to the client includes:
根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化,若未变化,则将取出的消息数据包推送至所述客户端。According to the network type identifier, it is judged whether the communication network accessed by the client has changed compared with that before the push failure, and if there is no change, the fetched message data packet is pushed to the client.
A3、如权A2所述的方法,所述根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化,具体包括:A3. The method as described in A2, the judging according to the network type identifier whether the communication network accessed by the client has changed compared with that before the push failure, specifically including:
判断所述网络类型标识与预存类型标识是否相同;judging whether the network type identifier is the same as the pre-stored type identifier;
若相同,则认定所述客户端接入的通信网络未变化;If they are the same, it is determined that the communication network accessed by the client has not changed;
若不相同,则认定所述客户端接入的通信网络变化,并将所述网络类型标识作为预存类型标识。If not, it is determined that the communication network accessed by the client has changed, and the network type identifier is used as the pre-stored type identifier.
A4、如A2~A3中任一项所述的方法,所述根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化之后,所述方法还包括:A4. The method according to any one of A2-A3, after determining whether the communication network accessed by the client has changed according to the network type identifier compared with before the push failure, the method further includes:
若变化,则根据所述网络类型标识查找映射关系,获得与所述网络类型标识对应的通信网络,将取出的消息数据包通过查找获得的通信网络推送至所述客户端。If it changes, look up the mapping relationship according to the network type identifier, obtain the communication network corresponding to the network type identifier, and push the retrieved message data packet to the client through the communication network obtained through the search.
A5、如A1~A4中任一项所述的方法,所述在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列之前,所述方法还包括:A5. The method according to any one of A1-A4, when the message data packet of the message queue fails to be pushed to the client, before putting the message data packet back into the message queue, the method also includes :
将消息队列的消息数据包向客户端进行推送,在预设时间内未收到所述客户端返回的确定字符时,认定向所述客户端推送消息失败。Pushing the message data packet of the message queue to the client, if no confirm character returned by the client is received within a preset time, it is determined that the push of the message to the client fails.
A6、如A1~A5中任一项所述的方法,所述消息数据包中包括:消息类型和/或时间戳;A6. The method according to any one of A1-A5, wherein the message data packet includes: message type and/or time stamp;
相应地,所述从所述消息队列中取出消息数据包,具体包括:Correspondingly, the taking out the message data packet from the message queue specifically includes:
根据所述消息数据包中的消息类型和/或时间戳从所述消息队列中取出消息数据包。The message data packet is taken out from the message queue according to the message type and/or the time stamp in the message data packet.
B7、一种消息传送装置,包括:B7. A messaging device, comprising:
处理单元,适于在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列;The processing unit is adapted to put the message data packet back into the message queue when pushing the message data packet of the message queue to the client fails;
推送单元,适于在获取到所述客户端发送的连接请求时,从所述消息队列中取出消息数据包,将取出的消息数据包推送至所述客户端。The push unit is adapted to take out a message data packet from the message queue when obtaining the connection request sent by the client, and push the taken out message data packet to the client.
B8、如B7所述的装置,所述连接请求中包括所述客户端接入通信网络的网络类型标识;B8. The device according to B7, wherein the connection request includes a network type identifier for the client to access the communication network;
相应地,所述推送单元,具体包括:Correspondingly, the push unit specifically includes:
判断模块,适于根据所述网络类型标识判断所述客户端接入的通信网络与推送失败前相比是否变化;The judging module is adapted to judge whether the communication network accessed by the client has changed compared with that before the push failure according to the network type identifier;
推送模块,适于当所述判断模块的判断结果为所述客户端接入的通信网络与推送失败前相比未变化时,将取出的消息数据包推送至所述客户端。The push module is adapted to push the retrieved message data packet to the client when the judging result of the judging module is that the communication network accessed by the client has not changed compared with that before the push failure.
B9、如B8所述的装置,所述判断模块,具体适于判断所述网络类型标识与预存类型标识是否相同,若相同,则认定所述客户端接入的通信网络未变化,若不相同,则认定所述客户端接入的通信网络变化,并将所述网络类型标识作为预存类型标识。B9, the device as described in B8, the judging module is specifically adapted to judge whether the network type identifier is the same as the pre-stored type identifier, if they are the same, it is determined that the communication network accessed by the client has not changed, if they are not the same , it is determined that the communication network accessed by the client has changed, and the network type identifier is used as the pre-stored type identifier.
B10、如B8~B9中任一项所述的装置,所述推送模块,还适于当所述判断模块的判断结果为所述客户端接入的通信网络与推送失败前相比发生变化时,根据所述网络类型标识查找映射关系,获得与所述网络类型标识对应的通信网络,将取出的消息数据包通过查找获得的通信网络推送至所述客户端。B10. The device as described in any one of B8 to B9, the push module is also suitable for when the judgment result of the judgment module is that the communication network accessed by the client has changed compared with that before the push failure Searching for a mapping relationship according to the network type identifier to obtain a communication network corresponding to the network type identifier, and pushing the retrieved message data packet to the client through the communication network obtained through the search.
B11、如B7~B10中任一项所述的装置,所述推送单元,还适于在将消息队列的消息数据包向客户端推送失败时,将所述消息数据包重新放入消息队列之前,将消息队列的消息数据包向客户端进行推送,在预设时间内未收到所述客户端返回的确定字符时,认定向所述客户端推送消息失败。B11. The device according to any one of B7 to B10, the push unit is further adapted to re-put the message data packet into the message queue when the message data packet of the message queue fails to be pushed to the client , push the message data packet of the message queue to the client, and if no confirmation character returned by the client is received within a preset time, it is determined that the push of the message to the client fails.
B12、如B7~B11中任一项所述的装置,所述消息数据包中包括:消息类型和/或时间戳;B12. The device according to any one of B7 to B11, wherein the message data packet includes: message type and/or time stamp;
相应地,所述推送单元,具体适于根据所述消息数据包中的消息类型和/或时间戳从所述消息队列中取出消息数据包。Correspondingly, the push unit is specifically adapted to take out the message data packet from the message queue according to the message type and/or the time stamp in the message data packet.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510997618.4A CN105657000A (en) | 2015-12-25 | 2015-12-25 | Message transmission method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510997618.4A CN105657000A (en) | 2015-12-25 | 2015-12-25 | Message transmission method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105657000A true CN105657000A (en) | 2016-06-08 |
Family
ID=56477844
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510997618.4A Pending CN105657000A (en) | 2015-12-25 | 2015-12-25 | Message transmission method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105657000A (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106453635A (en) * | 2016-11-21 | 2017-02-22 | 深圳广联赛讯有限公司 | Message pushing method and device |
CN107070782A (en) * | 2017-05-02 | 2017-08-18 | 山东浪潮通软信息科技有限公司 | A kind of Interface integration method, server and the system expansible based on message queue |
CN108234578A (en) * | 2016-12-22 | 2018-06-29 | 航天信息股份有限公司 | A kind of method and device of push |
CN108449410A (en) * | 2018-03-19 | 2018-08-24 | 深信服科技股份有限公司 | Information management method, system and relevant apparatus in a kind of cloud platform |
CN108718286A (en) * | 2018-05-24 | 2018-10-30 | 北京无线电测量研究所 | Data communications method, system and storage medium |
CN108900370A (en) * | 2018-06-08 | 2018-11-27 | 努比亚技术有限公司 | It is long to connect multiple overtime judgment method, device and computer readable storage medium |
CN110166576A (en) * | 2019-06-28 | 2019-08-23 | 飞天诚信科技股份有限公司 | It is a kind of to realize that cloud speaker message mends the method and system pushed away |
CN110233883A (en) * | 2019-05-24 | 2019-09-13 | 中国平安人寿保险股份有限公司 | Processing method, device, server and the storage medium of PUSH message |
CN110740103A (en) * | 2019-09-02 | 2020-01-31 | 深圳壹账通智能科技有限公司 | Service request processing method and device, computer equipment and storage medium |
CN112468386A (en) * | 2020-11-17 | 2021-03-09 | 福建天泉教育科技有限公司 | Method and terminal for processing repeated messages |
CN116434601A (en) * | 2023-04-25 | 2023-07-14 | 广州市单元信息科技有限公司 | Intelligent processing method and system for message pushing |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101175325A (en) * | 2007-10-19 | 2008-05-07 | 中兴通讯股份有限公司 | Terminal switching method and device under multi-network mode |
CN102347967A (en) * | 2010-07-30 | 2012-02-08 | 华为技术有限公司 | Method and device for cooperation between push equipment |
CN103095732A (en) * | 2013-03-01 | 2013-05-08 | 畅捷通信息技术股份有限公司 | Information push system and information push method |
US20140047065A1 (en) * | 2011-05-16 | 2014-02-13 | Sk Telecom Co., Ltd. | System, device and method for providing push service using feedback message |
CN104506416A (en) * | 2014-12-17 | 2015-04-08 | 东软集团股份有限公司 | Method, device and system for implementing stable message forwarding |
CN104580346A (en) * | 2014-09-11 | 2015-04-29 | 奇点新源国际技术开发(北京)有限公司 | Data transmission method and device |
-
2015
- 2015-12-25 CN CN201510997618.4A patent/CN105657000A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101175325A (en) * | 2007-10-19 | 2008-05-07 | 中兴通讯股份有限公司 | Terminal switching method and device under multi-network mode |
CN102347967A (en) * | 2010-07-30 | 2012-02-08 | 华为技术有限公司 | Method and device for cooperation between push equipment |
US20140047065A1 (en) * | 2011-05-16 | 2014-02-13 | Sk Telecom Co., Ltd. | System, device and method for providing push service using feedback message |
CN103095732A (en) * | 2013-03-01 | 2013-05-08 | 畅捷通信息技术股份有限公司 | Information push system and information push method |
CN104580346A (en) * | 2014-09-11 | 2015-04-29 | 奇点新源国际技术开发(北京)有限公司 | Data transmission method and device |
CN104506416A (en) * | 2014-12-17 | 2015-04-08 | 东软集团股份有限公司 | Method, device and system for implementing stable message forwarding |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106453635B (en) * | 2016-11-21 | 2019-08-06 | 深圳广联赛讯有限公司 | Information push method and device |
CN106453635A (en) * | 2016-11-21 | 2017-02-22 | 深圳广联赛讯有限公司 | Message pushing method and device |
CN108234578A (en) * | 2016-12-22 | 2018-06-29 | 航天信息股份有限公司 | A kind of method and device of push |
CN107070782A (en) * | 2017-05-02 | 2017-08-18 | 山东浪潮通软信息科技有限公司 | A kind of Interface integration method, server and the system expansible based on message queue |
CN108449410A (en) * | 2018-03-19 | 2018-08-24 | 深信服科技股份有限公司 | Information management method, system and relevant apparatus in a kind of cloud platform |
CN108449410B (en) * | 2018-03-19 | 2022-03-22 | 深信服科技股份有限公司 | Message management method, system and related device in cloud platform |
CN108718286A (en) * | 2018-05-24 | 2018-10-30 | 北京无线电测量研究所 | Data communications method, system and storage medium |
CN108718286B (en) * | 2018-05-24 | 2022-05-03 | 北京无线电测量研究所 | Data communication method, system and storage medium |
CN108900370B (en) * | 2018-06-08 | 2021-12-17 | 努比亚技术有限公司 | Long connection multiple timeout judging method, device and computer readable storage medium |
CN108900370A (en) * | 2018-06-08 | 2018-11-27 | 努比亚技术有限公司 | It is long to connect multiple overtime judgment method, device and computer readable storage medium |
CN110233883A (en) * | 2019-05-24 | 2019-09-13 | 中国平安人寿保险股份有限公司 | Processing method, device, server and the storage medium of PUSH message |
CN110166576A (en) * | 2019-06-28 | 2019-08-23 | 飞天诚信科技股份有限公司 | It is a kind of to realize that cloud speaker message mends the method and system pushed away |
CN110166576B (en) * | 2019-06-28 | 2022-07-01 | 飞天诚信科技股份有限公司 | Method and system for realizing message complementary pushing of cloud sound box |
CN110740103A (en) * | 2019-09-02 | 2020-01-31 | 深圳壹账通智能科技有限公司 | Service request processing method and device, computer equipment and storage medium |
CN112468386A (en) * | 2020-11-17 | 2021-03-09 | 福建天泉教育科技有限公司 | Method and terminal for processing repeated messages |
CN116434601A (en) * | 2023-04-25 | 2023-07-14 | 广州市单元信息科技有限公司 | Intelligent processing method and system for message pushing |
CN116434601B (en) * | 2023-04-25 | 2023-12-29 | 广州市单元信息科技有限公司 | Intelligent processing method and system for message pushing |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105657000A (en) | Message transmission method and device | |
CN107566786B (en) | Method and device for acquiring monitoring video and terminal equipment | |
CN104767775B (en) | Web application information push method and system | |
CN105337961B (en) | The method and server communicated with client | |
WO2016023357A1 (en) | Webpage access method and apparatus, and router | |
WO2021237433A1 (en) | Message pushing method and apparatus, and electronic device and computer-readable medium | |
CN102904903B (en) | Communication system and communication means | |
WO2017174026A1 (en) | Client connection method and system | |
US10623450B2 (en) | Access to data on a remote device | |
EP2709337B1 (en) | Service data processing method, device and system | |
CN104468594B (en) | The method, apparatus and system of a kind of request of data | |
CN103685501A (en) | Data processing method, device and system | |
EP3119044B1 (en) | Page insertion method and device | |
CN108460042B (en) | Page display method, related equipment and system | |
CN103036989B (en) | Socket server and socket service methods | |
WO2019242279A1 (en) | Message processing method and device | |
WO2017185632A1 (en) | Data transmission method and electronic device | |
CN107612831B (en) | A method and device for transmitting data message for accessing source station | |
CN106357764B (en) | Data synchronization method of mobile terminal and server | |
US9634987B2 (en) | Obtaining a MAC address from an external source | |
EP3293924B1 (en) | Message processing method and device | |
CN112306791B (en) | Performance monitoring method and device | |
CN111245874B (en) | Information pushing method, device, server and storage medium | |
US10237592B2 (en) | Method and apparatus for video transmission | |
CN105224573B (en) | A method, device and system for configuring rule data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160608 |
|
RJ01 | Rejection of invention patent application after publication |