CN114760297A - Message pushing method, system, equipment and readable storage medium - Google Patents

Message pushing method, system, equipment and readable storage medium Download PDF

Info

Publication number
CN114760297A
CN114760297A CN202210261298.6A CN202210261298A CN114760297A CN 114760297 A CN114760297 A CN 114760297A CN 202210261298 A CN202210261298 A CN 202210261298A CN 114760297 A CN114760297 A CN 114760297A
Authority
CN
China
Prior art keywords
internet
long connection
message
things
identification information
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
CN202210261298.6A
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.)
Glodon Co Ltd
Original Assignee
Glodon Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Glodon Co Ltd filed Critical Glodon Co Ltd
Priority to CN202210261298.6A priority Critical patent/CN114760297A/en
Publication of CN114760297A publication Critical patent/CN114760297A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a message pushing method, a system, a device and a readable storage medium, wherein the method comprises the following steps: periodically acquiring a message to be pushed from a preset storage space of the Internet of things according to a set time interval; the message to be pushed is stored in the preset storage space by a management background of the Internet of things through a management background server; analyzing the identity identification information of the target Internet of things equipment from the message to be pushed, and judging whether the identity identification information of the target Internet of things equipment exists in the identity identification information of all Internet of things equipment which establishes long connection with the long connection server; if yes, sending the message to be pushed to the target Internet of things equipment through long connection; if not, discarding the message to be pushed; the method and the device can remove the dependence of message pushing on the cache in the scene of message communication between the Internet of things equipment and the cloud.

Description

Message pushing method, system, equipment and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, a system, a device, and a readable storage medium for pushing a message.
Background
In the prior art, when the internet of things device needs to communicate with the cloud server based on the internet of things, a long connection service between the internet of things device and the long connection server at the cloud end needs to be established, and with the increasing of the internet of things device, a plurality of long connection servers need to be arranged at the cloud end, so that the corresponding relation between the internet of things device and the long connection servers needs to be stored in a cache (for example, Redis) at the cloud end, as shown in fig. 1, when a message to be pushed and sent to a target internet of things device is generated at a management background at the cloud end, the message to be pushed needs to be sent to the management background server firstly, then the management background server inquires the long connection server establishing long connection with the target internet of things device from the cache, and sends the message to be pushed to the target internet of things device through the inquired long connection server, however, the message pushing mode depends on cache seriously, and if the cache has problems, the message pushing function of the long-connection server is completely paralyzed; even if the cache is recovered from the abnormal state, because the corresponding relationship between the internet of things device and the long connection server recorded in the cache disappears, the management background server cannot acquire the long connection server corresponding to the message to be pushed from the cache, and cannot send the message to be pushed to the long connection server, so that the message pushing is interrupted.
Therefore, how to remove the dependence of message pushing on the cache in the scene of message communication between the internet of things device and the cloud becomes a technical problem that needs to be solved urgently by technical personnel in the field.
Disclosure of Invention
The invention aims to provide a message pushing method, a message pushing system, message pushing equipment and a readable storage medium, which can remove the dependence of message pushing on cache in the scene of message communication between Internet of things equipment and a cloud.
According to an aspect of the present invention, a message pushing method is provided, which is applied to a long connection server of the internet of things, and the method includes:
periodically acquiring a message to be pushed from a preset storage space of the Internet of things according to a set time interval; the message to be pushed is stored in the preset storage space by a management background of the Internet of things through a management background server;
analyzing the identity identification information of the target Internet of things equipment from the message to be pushed, and judging whether the identity identification information of the target Internet of things equipment exists in the identity identification information of all Internet of things equipment which establishes long connection with the long connection server;
if yes, sending the message to be pushed to the target Internet of things equipment through long connection; and if not, discarding the message to be pushed.
Optionally, before the message to be pushed is periodically obtained from the preset storage space of the internet of things according to the set time interval, the method further includes:
receiving a connection establishment request which is sent by the equipment of the Internet of things to be established and forwarded by the load balancing equipment;
analyzing the identity identification information of the to-be-built Internet of things equipment from the building request;
and establishing long connection between the long connection server and the Internet of things equipment to be established based on the analyzed identity identification information.
Optionally, after the long connection is established between the long connection server and the to-be-established internet of things device based on the analyzed identity identification information, the method further includes:
the method comprises the steps of obtaining a socket of the established long connection, storing the identification information of the to-be-established Internet of things equipment and the socket into an identification information table corresponding to the long connection server, and establishing the association relationship between the identification information of the to-be-established Internet of things equipment and the socket in the identification information table.
Optionally, the determining whether the identification information of the target internet of things device exists in the identification information of all internet of things devices that establish long connection with the long connection server specifically includes:
judging whether the identity information of the target Internet of things equipment exists in an identity information table corresponding to the long connection service;
the sending the message to be pushed to the target internet of things device through long connection specifically comprises:
acquiring a target socket which has an incidence relation with the identity identification information of the target Internet of things equipment from an identity information table corresponding to the long connection service;
and sending the message to be pushed to the target Internet of things equipment through long connection corresponding to the target socket.
Optionally, the preset storage space is a message middleware.
In order to achieve the above object, the present invention further provides a message pushing system applied to the internet of things, where the system includes: the system comprises an Internet of things device, a load balancing device, a long connection server, a management background and a management background server;
the Internet of things equipment is used for sending a connection establishment request for establishing long connection between a representation request and a long connection server to the load balancing equipment;
the load balancing equipment is used for determining a target long connection server according to the residual resources of each long connection server and forwarding the connection establishing request to the target long connection server;
the long connection server is used for analyzing the identity identification information of the to-be-established Internet of things equipment from the establishment request and establishing long connection between the long connection server and the to-be-established Internet of things equipment based on the analyzed identity identification information;
the management background is used for generating a message to be pushed and sent to target Internet of things equipment and sending the message to be pushed to the management background server;
the management background server is used for forwarding the message to be pushed to a message middleware;
the long connection server is also used for periodically acquiring the message to be pushed from the message middleware according to a set time interval; analyzing the identity identification information of the target Internet of things equipment from the message to be pushed, and judging whether the identity identification information of the target Internet of things equipment exists in the identity identification information of all Internet of things equipment which establishes long connection with the long connection server; if yes, sending the message to be pushed to the target Internet of things equipment through long connection; and if not, discarding the message to be pushed.
Optionally, after the step of establishing the long connection between the long connection server and the to-be-established internet of things device is completed, the long connection server is further configured to:
the method comprises the steps of obtaining a socket of the established long connection, storing the identification information of the to-be-established Internet of things equipment and the socket into an identification information table corresponding to the long connection server, and establishing the association relationship between the identification information of the to-be-established Internet of things equipment and the socket in the identification information table.
Optionally, when the step of determining whether the identification information of the target internet of things device exists in the identification information of all internet of things devices that establish long connection with the long connection server is executed by the long connection server, the long connection server is specifically configured to:
judging whether the identity information of the target Internet of things equipment exists in the identity information table or not;
the long connection server is specifically configured to, when executing the step of sending the message to be pushed to the target internet of things device through long connection:
acquiring a target socket which has an incidence relation with the identity identification information of the target Internet of things equipment from the identity information table;
and sending the message to be pushed to the target Internet of things equipment through long connection corresponding to the target socket.
In order to achieve the above object, the present invention further provides a computer device, which specifically includes: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the message pushing method introduced above when executing the computer program.
In order to achieve the above object, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the above introduced message push method.
According to the message pushing method, the message pushing system, the message pushing device and the readable storage medium, the message to be pushed, which is produced by the management background of the Internet of things and is used for pushing to the target Internet of things device, is stored by using the message middleware, the message to be pushed is periodically pulled from the message middleware by the long-connection server, and the message to be pushed is pushed to the target Internet of things device which is in long connection with the message to be pushed, so that message communication between the management background of the cloud and the Internet of things device is realized; because the corresponding relation between the Internet of things equipment and the long connection server is not required to be recorded by using a cache, the dependence of the message pushing process on the cache in the prior art is avoided, the situation that the corresponding relation between the Internet of things equipment and the long connection server needs to be cached again due to the abnormal cache is avoided, the cache is not required to be updated when the corresponding relation between the Internet of things equipment and the long connection server is replaced, and the framework of message pushing is simpler; in addition, when the management background of the cloud end pushes the information to the internet of things equipment, the management background server does not need to acquire the long connection server corresponding to the internet of things equipment from the cache, and the information to be pushed does not need to be sent to the long connection server, so that the pushing logic of the management background of the cloud end and the management background server is simplified; meanwhile, the message middleware has the function of peak clipping and valley filling, so that the message to be pushed is stored through the message middleware, the scene that a management background server instantly sends a large number of messages to be pushed can be easily coped with, and the operating pressure of the equipment of the Internet of things and the long connection server is relieved; and because the corresponding relation between the Internet of things equipment and the long connection server is stored in the long connection server, even if the message middleware is abnormal, the corresponding relation between the Internet of things equipment and the long connection server is not influenced, so that the message middleware is used for replacing cache, and the safety and reliability of message communication between the Internet of things equipment and the cloud can be enhanced, therefore, the message middleware has higher usability and stability relative to the cache, and the message pushing efficiency is improved.
Drawings
Various additional advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flow chart of a message pushing method applied to the internet of things in the prior art;
fig. 2 is an alternative flowchart of a message pushing method according to an embodiment;
fig. 3 is a schematic flowchart of another alternative message pushing method according to an embodiment;
fig. 4 is a schematic structural diagram of a message pushing system according to a third embodiment;
fig. 5 is a schematic diagram of an alternative hardware architecture of the computer device according to the fourth embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
In the prior art, when the internet of things device and the cloud server communicate based on the internet of things, a long connection between the internet of things device and the long connection server at the cloud end needs to be established first, and the corresponding relationship between the internet of things device and the long connection server is recorded in the long connection server, so that the long connection server can continue to perform message communication with the internet of things device through the long connection. The long connection is used without frequent connection establishment and disconnection, so that the performance consumption is avoided, and the communication between the Internet of things equipment and the long connection server is optimized.
When a scene that a long connection server actively sends a message to be pushed to the Internet of things equipment is not involved, the long connection can be freely expanded and reduced; however, as the number of the internet of things devices increases, a plurality of long connection servers are correspondingly required to be deployed at the cloud for connection and communication with the plurality of internet of things devices, and at this time, a cache (for example, Redis) is required to record the corresponding relationship between the internet of things devices and the long connection servers. In the prior art, a traditional solution for sending a message to be pushed to an internet of things device by a management backend at the cloud is shown in fig. 1, after the internet of things device and a long connection server are connected through a load balancing device, a cache is needed to record a corresponding relation between the internet of things device and the long connection server, and the corresponding relation between the internet of things device and the long connection server in the cache is deleted when the long connection is disconnected. Although the prior art can realize message communication between the internet of things equipment and the management background of the cloud, the prior art has the following defects that the message pushing process depends heavily on the corresponding relation between the internet of things equipment and the long connection server recorded in the cache, the requirements on the stability and the performance of the cache are high, and when a problem occurs in the cache, the pushing function of the long connection server is completely disabled; after the cache is recovered from the abnormal state, the corresponding relation between the internet of things equipment and the long connection server does not exist in the cache, if the server needs to actively send a message to the internet of things equipment, the message can be continuously pushed to the internet of things equipment from the management background of the cloud end after the cache records the corresponding relation between the internet of things equipment and the long connection server again, and the message pushing efficiency is seriously influenced.
The embodiment of the invention provides a message pushing method, which is applied to a long connection server of the Internet of things as shown in FIG. 2, and specifically comprises the following steps:
step S101: periodically acquiring a message to be pushed from a preset storage space of the Internet of things according to a set time interval; and the message to be pushed is stored in the preset storage space by a management background of the Internet of things through a management background server.
The message to be pushed comprises the identification information of the target Internet of things equipment corresponding to the message.
Specifically, the preset storage space is a message middleware, the management background of the internet of things is used as a Producer (Producer) of the message middleware, the long connection server is used as a Consumer (Consumer) of the message middleware, the message to be pushed, which is generated by the management background of the internet of things and is forwarded by the management background server and is pushed to the target internet of things device, exists in a Key-Value form, the Key is the identification information of the internet of things device corresponding to the message to be pushed, and the Value is the content of the message to be pushed. As shown in fig. 3, when the management backend of the internet of things produces a message to be pushed, the management backend server needs to forward the message to be pushed to the message middleware in advance for storage, so that the long connection server acquires the message to be pushed from the message middleware according to the preset time.
Specifically, the message middleware is one of RockettMQ, ActiveMQ, RabbitMQ and Kafka. Preferably, the message middleware is Kafka.
In this embodiment, a manner of additionally adding the corresponding relationship between the internet of things device and the long connection server to the cache in the prior art is abandoned, and only the corresponding relationship between the internet of things device and the long connection server needs to be recorded in the long connection server, and the message to be pushed is stored by means of the message middleware, so that the long connection server can acquire the message to be pushed, which meets the pushing requirement, from the message middleware, and actively send the message to be pushed to the internet of things device through long connection. Therefore, the message pushing process between the management background of the cloud and the Internet of things equipment does not need to depend on the corresponding relation between the Internet of things equipment and the long connection server recorded in the cache, and the problem that the pushing function of the long connection server is completely broken down when the cache fails is solved fundamentally. In addition, if the cache recovers from the abnormality, the corresponding relationship between the internet of things device and the long connection server does not exist in the cache, if the management background at the cloud generates a push message to be sent to the internet of things device, the cache needs to wait for recording the corresponding relationship between the internet of things device and the long connection server again, and then the message can be continuously pushed to the internet of things device from the management background at the cloud. The message middleware has higher availability and stability than the cache. Meanwhile, the message middleware has the characteristic of peak clipping and valley filling, so that scenes of a large number of instant messages to be pushed can be easily coped with. When the push efficiency needs to be improved, linear improvement of the push efficiency can be quickly and conveniently realized by increasing the number of fragments of the message queue and the number of long connection servers in the message middleware.
Further, before the message to be pushed is periodically acquired from the preset storage space of the internet of things according to the set time interval, the method further includes:
step A1: receiving a connection establishment request which is sent by the equipment of the Internet of things to be established and forwarded by the load balancing equipment;
the load balancing equipment is equipment which uniformly disperses a connection request sent by the equipment of the Internet of things to be connected to the long connection server with the residual resources by adopting a balanced distribution algorithm, and the load balancing equipment enables the connection request to obtain the response of the long connection server connected with the load balancing equipment as fast as possible by managing the received connection request and the long connection server, so that the reasonable distribution of the long connection server is realized.
Step A2: analyzing the identity identification information of the Internet of things equipment to be built from the building request;
the identity identification information of the to-be-built Internet of things equipment is the unique identification of the to-be-built Internet of things equipment.
Step A3: and establishing long connection between the long connection server and the equipment of the Internet of things to be established based on the analyzed identity identification information.
The long connection means that a plurality of messages to be pushed can be continuously sent on one transmission connection, and if no message to be pushed is sent during the long connection holding period, a heartbeat packet needs to be sent regularly to ensure the availability of the long connection.
Further, after the long connection is established between the long connection server and the to-be-established internet of things device based on the analyzed identification information, the method further includes:
the method comprises the steps of obtaining a socket of the established long connection, storing the identification information of the to-be-established Internet of things equipment and the socket into an identification information table corresponding to the long connection server, and establishing the association relationship between the identification information of the to-be-established Internet of things equipment and the socket in the identification information table.
The socket of the long connection is a socket interface which is established on a transmission protocol and used for supporting establishment of a bidirectional communication channel between the long connection server and the Internet of things equipment, and the socket is composed of identification information of the Internet of things equipment to be established, the transmission protocol (such as a TCP protocol) and IP address information of the long connection server.
Specifically, different long connection servers correspond to different identity information tables, and the identity information tables are used for storing identity identification information of each piece of internet-of-things equipment connected with the long connection servers and socket sockets of long connections established between the long connection servers and the pieces of internet-of-things equipment.
In the embodiment, because a large number of long connections established between the internet of things equipment and the long connection server exist in the communication process, in order to distinguish different long connections, a corresponding socket is set for the long connection established between each long connection server and the internet of things equipment to be established, so as to distinguish different long connections established between the same long connection server and a plurality of internet of things devices, the long connection server can distinguish the messages to be pushed, which are stored in the message middleware and need to be pushed to different internet of things devices, through the socket, so that the accurate pushing of the messages to be pushed is realized, the management background server is not required to obtain the long connection server connected with the internet of things devices corresponding to the messages to be pushed from the cache, and the logic of pushing the messages to be pushed to the internet of things devices by the management background at the cloud end is simplified.
Step S102: and analyzing the identity identification information of the target Internet of things equipment from the message to be pushed, and judging whether the identity identification information of the target Internet of things equipment exists in the identity identification information of all the Internet of things equipment which establishes long connection with the long connection server.
Specifically, the determining whether the identification information of the target internet of things device exists in the identification information of all the internet of things devices that establish long connection with the long connection server includes the following steps:
and judging whether the identity information of the target Internet of things equipment exists in the identity information table.
The socket communication with the target Internet of things equipment can be obtained by only obtaining the identification information of the target Internet of things equipment and searching the socket of the long connection having the association relation with the identification information from the identification information table.
Step S103: if the identity identification information of the target Internet of things equipment exists in the identity identification information of all the Internet of things equipment which establishes long connection with the long connection server, the message to be pushed is sent to the target Internet of things equipment through long connection; and if the identity identification information of the target Internet of things equipment does not exist in the identity identification information of all the Internet of things equipment which establishes long connection with the long connection server, ignoring the message to be pushed.
In this embodiment, since the messages to be pushed stored in the message middleware all carry the identification information of the corresponding target internet of things device, the long connection server only needs to acquire the messages to be pushed from the message middleware at preset time intervals, and judge whether the target internet of things device corresponding to the identification information carried in the messages to be pushed is the internet of things device which establishes the long connection with the long connection itself, and if so, send the messages to be pushed to the target internet of things device through the long connection. According to the message pushing method provided by the embodiment, the management background server corresponding to the management background of the Internet of things does not need to acquire the long connection server corresponding to the message to be pushed from the cache, and does not need to acquire the corresponding relation between the long connection server and the Internet of things equipment connected with the long connection server, and only the management background server needs to send the message to be pushed to the message middleware, so that the pushing logic of the management background of the cloud is optimized, the dependence of the pushed message on the cache is also stripped, and the pushing efficiency is improved.
Further, the sending the message to be pushed to the target internet of things device through a long connection specifically includes:
step B1: acquiring a target socket which has an incidence relation with the identity identification information of the target Internet of things equipment from the identity information table;
step B2: and sending the message to be pushed to the target Internet of things equipment through long connection corresponding to the target socket.
In the embodiment, a message to be pushed, which is produced by a management background of the internet of things and is pushed to target internet of things equipment, is stored by using a message middleware, the message to be pushed is periodically pulled from the message middleware by a long connection server, and the message to be pushed is pushed to the target internet of things equipment which establishes long connection with the message to be pushed, so that message communication between the management background of the cloud and the internet of things equipment is realized; because the corresponding relation between the Internet of things equipment and the long connection server is not required to be recorded by using a cache, the dependence of the message pushing process on the cache in the prior art is avoided, the condition that the corresponding relation between the Internet of things equipment and the long connection server is required to be cached again due to the abnormal cache is not required to be worried about, and the cache is not required to be updated when the corresponding relation between the Internet of things equipment and the long connection server is replaced, so that the framework of message pushing is simpler; in addition, when the management background of the cloud end pushes the information to the internet of things equipment, the management background server does not need to acquire the long connection server corresponding to the internet of things equipment from the cache, so that the information to be pushed does not need to be sent to the long connection server, and the pushing logic of the management background of the cloud end and the management background server is simplified; meanwhile, the message middleware has the function of peak clipping and valley filling, so that the message to be pushed is stored through the message middleware, the scene that a management background server instantly sends a large number of messages to be pushed can be easily coped with, and the operating pressure of the equipment of the Internet of things and the long connection server is relieved; and because the corresponding relation between the Internet of things equipment and the long connection server is stored in the long connection server, even if the message middleware is abnormal, the corresponding relation between the Internet of things equipment and the long connection server is not influenced, so that the message middleware is used for replacing cache, and the safety and reliability of message communication between the Internet of things equipment and the cloud can be enhanced, therefore, the message middleware has higher usability and stability relative to the cache, and the message pushing efficiency is improved.
Example two
A message pushing method is applied to the Internet of things, wherein the Internet of things comprises the following steps: the method comprises the following steps of Internet of things equipment, load balancing equipment, a long connection server, a management background and a management background server, wherein the method specifically comprises the following steps:
step S1: and the target Internet of things equipment sends a connection establishment request for establishing long connection with the long connection server to the load balancing equipment.
The connection establishing request comprises identity identification information of the target Internet of things equipment; preferably, the identification information is a unique identifier of the target internet of things device.
Step S2: and the load balancing equipment determines a target long connection server according to the residual resources of each long connection server and forwards the connection establishing request to the target long connection server.
The load balancing equipment is equipment which uniformly disperses a connection establishing request sent by the equipment of the Internet of things to be established to the long connection server with the residual resources by adopting a balanced distribution algorithm, and the load balancing equipment enables the connection establishing request to obtain the response of the target long connection server connected with the load balancing equipment as fast as possible by managing the received connection establishing request and the long connection server, so that the reasonable distribution of the long connection server is realized.
Step S3: the target long connection server analyzes the identity identification information of the target Internet of things equipment from the connection establishing request, and establishes long connection between the long connection server and the target Internet of things equipment based on the analyzed identity identification information.
Step S4: the target long connection server acquires a socket of the established long connection, stores the identification information of the target Internet of things equipment and the socket into an identification information table corresponding to the target long connection server, and establishes the association relationship between the identification information of the to-be-established Internet of things equipment and the socket in the identification information table.
The different long connection servers correspond to different identity information tables, and identity identification information of the Internet of things equipment in the identity information tables and socket sockets of long connection established between the long connection servers and the Internet of things equipment are stored in an associated mode.
The step S1 to the step S4 are a process of establishing a connection between the internet of things device and the long connection server in the cloud, and the method further includes:
step S5: and the management background generates a message to be pushed, which is sent to the target Internet of things equipment, and sends the message to be pushed to the management background server.
The message to be pushed comprises the identity identification information of the target Internet of things equipment; preferably, the identification information of the target internet of things device is a unique identifier of the internet of things device.
Step S6: and the management background server forwards the message to be pushed to message middleware.
Step S7: and the target long connection server acquires the message to be pushed from the message middleware regularly according to a set time interval.
Step S8: and the target long connection server analyzes the identity identification information of the target Internet of things equipment from the message to be pushed.
Step S9: the target long connection server judges whether the identification information of the target Internet of things equipment exists in the identification information of all the Internet of things equipment with established long connection; if so, go to step S10, otherwise, go to step S11.
Specifically, the step S9 includes:
and judging whether the identity information of the target Internet of things equipment exists in the identity information table.
Step S10: and sending the message to be pushed to the target internet of things device through long connection, and re-executing the step S7.
Further, the step S10 includes:
acquiring a target socket which has an incidence relation with the identity identification information of the target Internet of things equipment from the identity information table;
and sending the message to be pushed to the target Internet of things equipment through the target socket.
Step S11: the message to be pushed is discarded and step S7 is executed again.
The steps S5 to S11 are processes of performing message communication between the cloud management background and the internet of things device.
EXAMPLE III
The third embodiment of the present invention further provides a message pushing system, which corresponds to the message pushing method provided in the first embodiment. Specifically, fig. 4 shows a block diagram of a message pushing system provided in the third embodiment of the present invention. As shown in fig. 4, the message pushing system 400 may include an internet of things device 401, a load balancing device 402, a long connection server 403, a management backend 404, and a management backend server 405, where;
the internet of things device 401 is configured to send a connection establishment request for establishing a long connection with the long connection server 403 to the load balancing device 402;
specifically, the connection establishment request includes identification information of the internet of things device 401.
Further, the load balancing device 402 is configured to determine a target long connection server 403 according to the remaining resources of each long connection server 403, and forward the connection establishment request to the target long connection server 403;
the load balancing device 402 is a device that uses a balanced distribution algorithm to uniformly distribute the connection request sent by the internet of things device 401 to be connected to the long connection server 403 with the remaining resources, and the load balancing device 402 manages the received connection request and the long connection server 403, so that the connection request can obtain the response of the long connection server 403 connected to the connection request as quickly as possible, and reasonable distribution of the long connection server 403 is achieved.
Specifically, the long connection server 403 is configured to analyze the identity identification information of the to-be-connected internet-of-things device 401 from the connection establishing request, and establish a long connection between the long connection server 403 and the to-be-connected internet-of-things device 401 based on the analyzed identity identification information;
the long connection means that a plurality of message packets to be pushed can be continuously sent on one transmission connection, then the long connection is disconnected, and during the long connection holding period, if no message to be pushed of the data packet is sent, a heartbeat packet needs to be sent at regular time to ensure the availability of the long connection.
Further, the management background 404 is configured to generate a message to be pushed, which is sent to the target internet of things device 401, and send the message to be pushed to the management background server 405;
the message to be pushed comprises the identification information of the target internet of things device 401; preferably, the identification information of the target internet of things device 401 is a unique identifier of the target internet of things device 401 (generally, a UUID generated according to hardware information of the device or an IMEI of the device is used).
Further, the management backend server 405 is configured to forward the message to be pushed to the message middleware;
in this embodiment, the management backend server 405 does not need to obtain the long connection server 403 corresponding to the target internet of things device 401 from the cache, and also does not need to send the message to be pushed to the long connection server 403, and the management backend server 405 only needs to forward the message to be pushed to the message middleware, so that the logic for pushing the message by the management backend server 405 is simplified, and the message pushing efficiency is improved.
Specifically, the long connection server 403 is further configured to periodically obtain a message to be pushed from the message middleware according to a set time interval; analyzing the identity identification information of the target internet of things device 401 from the message to be pushed, and judging whether the identity identification information of the target internet of things device 401 exists in the identity identification information of all the internet of things devices 401 which establish long connection with the long connection server 403; if yes, the message to be pushed is sent to the target internet of things device 401 through long connection; and if not, discarding the message to be pushed.
In this embodiment, after the management background server 405 sends the message to be pushed to the message middleware, the long connection server 403 only needs to periodically obtain the message to be pushed from the message middleware according to a set time interval, and determines whether the identification information of the target internet of things device 401 exists in the identification information of all the internet of things devices 401 that establish long connections with the long connection server 403, so that dependence of the message pushing process on cache is eliminated, the message pushing efficiency is improved, and meanwhile, because the message middleware has the characteristic of peak clipping and valley filling, the operating pressure of the internet of things devices 401 and the long connection server 403 is relieved.
Further, after the step of establishing the long connection between the long connection server 403 and the to-be-established internet of things device 401 is completed, the long connection server 403 is further configured to:
the method comprises the steps of obtaining a socket of the established long connection, storing the identification information of the to-be-established Internet of things equipment 401 and the socket into an identification information table corresponding to the long connection server, and establishing the association relationship between the identification information of the to-be-established Internet of things equipment and the socket in the identification information table.
The socket for long connection is a socket interface established on a transport protocol and used for supporting establishment of a bidirectional communication channel between the long connection server 403 and the internet of things device 401, and the socket is composed of identification information of the internet of things device 401 to be established, the transport protocol, and a port IP of the long connection server 403.
Further, when the step of determining whether the identification information of the target internet of things device 401 exists in the identification information of all internet of things devices 401 that establish long connections with the long connection server 403 is executed by the long connection server 403, the long connection server 403 is specifically configured to:
and judging whether the identity information of the target internet of things device 401 exists in the identity information table.
When executing the step of sending the message to be pushed to the target internet of things device 401 through long connection, the long connection server 403 is specifically configured to:
acquiring a target socket which has an incidence relation with the identity identification information of the target internet of things device 401 from the identity information table;
and sending the message to be pushed to the target internet of things device 401 through the target socket.
In this embodiment, since the socket carries the identification information of the target internet of things device 401 and the IP address information of the long connection server 403, the long connection server 403 can quickly and accurately determine whether the identification information of the target internet of things device 401 exists in the identification information table corresponding to the long connection server, so that the long connection server 403 can send the message to be pushed to the target internet of things device 401 according to the socket, the message pushing process is simplified, and the message pushing efficiency is improved.
Example four
The embodiment also provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers) capable of executing programs, and the like. As shown in fig. 5, the computer device 50 of the present embodiment includes at least but is not limited to: a memory 501, a processor 502 communicatively coupled to each other via a system bus. It is noted that FIG. 5 only shows the computer device 50 having the components 501 and 502, but it is understood that not all of the shown components are required and that more or fewer components may be implemented instead.
In this embodiment, the memory 501 (i.e., a readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 501 may be an internal storage unit of the computer device 50, such as a hard disk or a memory of the computer device 50. In other embodiments, the memory 501 may also be an external storage device of the computer device 50, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 50. Of course, the memory 501 may also include both internal and external storage devices for the computer device 50. In the present embodiment, the memory 501 is generally used for storing an operating system and various types of application software installed in the computer device 50. Further, the memory 501 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 502 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 502 generally serves to control the overall operation of the computer device 50.
Specifically, in this embodiment, the processor 502 is configured to execute a program of a message pushing method stored in the memory 501, and when executed, the program of the message pushing method implements the following steps:
periodically acquiring a message to be pushed from a preset storage space of the Internet of things according to a set time interval; the message to be pushed is stored in the preset storage space by a management background of the Internet of things through a management background server;
analyzing the identity identification information of the target Internet of things equipment from the message to be pushed, and judging whether the identity identification information of the target Internet of things equipment exists in the identity identification information of all Internet of things equipment which establishes long connection with the long connection server;
if yes, sending the message to be pushed to the target Internet of things equipment through long connection; if not, discarding the message to be pushed.
The specific embodiment process of the above method steps can refer to embodiment one, and details are not repeated here.
EXAMPLE five
The present embodiments also provide a computer readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., having stored thereon a computer program that when executed by a processor implements the method steps of:
periodically acquiring a message to be pushed from a preset storage space of the Internet of things according to a set time interval; the message to be pushed is stored in the preset storage space by a management background of the Internet of things through a management background server;
analyzing the identity identification information of the target Internet of things equipment from the message to be pushed, and judging whether the identity identification information of the target Internet of things equipment exists in the identity identification information of all Internet of things equipment which establishes long connection with the long connection server;
if yes, sending the message to be pushed to the target Internet of things equipment through long connection; and if not, discarding the message to be pushed.
The specific embodiment process of the above method steps can be referred to as embodiment one, and the detailed description of this embodiment is not repeated herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A message pushing method is applied to a long connection server of the Internet of things, and comprises the following steps:
periodically acquiring a message to be pushed from a preset storage space of the Internet of things according to a set time interval; the message to be pushed is stored in the preset storage space by a management background of the Internet of things through a management background server;
analyzing the identity identification information of the target Internet of things equipment from the message to be pushed, and judging whether the identity identification information of the target Internet of things equipment exists in the identity identification information of all Internet of things equipment which establishes long connection with the long connection server;
if yes, sending the message to be pushed to the target Internet of things equipment through long connection; and if not, discarding the message to be pushed.
2. The message pushing method according to claim 1, wherein before the message to be pushed is periodically obtained from a preset storage space of the internet of things at a set time interval, the method further comprises:
receiving a connection establishment request which is sent by the equipment of the Internet of things to be established and forwarded by the load balancing equipment;
analyzing the identity identification information of the to-be-built Internet of things equipment from the building request;
and establishing long connection between the long connection server and the equipment of the Internet of things to be established based on the analyzed identity identification information.
3. The message pushing method according to claim 2, wherein after the long connection is established between the long connection server and the to-be-established internet of things device based on the parsed identification information, the method further comprises:
the method comprises the steps of obtaining a socket of the established long connection, storing the identification information of the to-be-established Internet of things equipment and the socket into an identification information table corresponding to the long connection server, and establishing the association relationship between the identification information of the to-be-established Internet of things equipment and the socket in the identification information table.
4. The message pushing method according to claim 3, wherein the determining whether the identification information of the target internet of things device exists in the identification information of all internet of things devices that establish long connection with the long connection server specifically includes:
judging whether the identity information of the target Internet of things equipment exists in an identity information table corresponding to the long connection service;
the sending the message to be pushed to the target internet of things device through long connection specifically comprises:
acquiring a target socket which has an incidence relation with the identity identification information of the target Internet of things equipment from an identity information table corresponding to the long connection service;
and sending the message to be pushed to the target Internet of things equipment through long connection corresponding to the target socket.
5. The message pushing method according to any one of claims 1 to 4, wherein the preset storage space is a message middleware.
6. A message pushing system is applied to the Internet of things, and comprises: the system comprises Internet of things equipment, load balancing equipment, a long connection server, a management background and a management background server;
the Internet of things equipment is used for sending a connection establishment request for establishing long connection between a representation request and a long connection server to the load balancing equipment;
the load balancing equipment is used for determining a target long connection server according to the residual resources of each long connection server and forwarding the connection establishing request to the target long connection server;
the long connection server is used for analyzing the identity identification information of the to-be-established Internet of things equipment from the establishment request and establishing long connection between the long connection server and the to-be-established Internet of things equipment based on the analyzed identity identification information;
the management background is used for generating a message to be pushed and sent to target Internet of things equipment, and sending the message to be pushed to the management background server;
the management background server is used for forwarding the message to be pushed to a message middleware;
the long connection server is also used for periodically acquiring the message to be pushed from the message middleware according to a set time interval; analyzing the identity identification information of the target Internet of things equipment from the message to be pushed, and judging whether the identity identification information of the target Internet of things equipment exists in the identity identification information of all Internet of things equipment which establishes long connection with the long connection server; if yes, sending the message to be pushed to the target Internet of things equipment through long connection; and if not, discarding the message to be pushed.
7. The message pushing system according to claim 6, wherein after the step of establishing the long connection between the long connection server and the to-be-established internet-of-things device is performed, the long connection server is further configured to:
the method comprises the steps of obtaining a socket of the established long connection, storing the identification information of the to-be-established Internet of things equipment and the socket into an identification information table corresponding to the long connection server, and establishing the association relationship between the identification information of the to-be-established Internet of things equipment and the socket in the identification information table.
8. The message pushing system according to claim 7, wherein the long connection server, when performing the step of determining whether the identification information of the target internet of things device exists in the identification information of all internet of things devices that establish long connections with the long connection server, is specifically configured to:
judging whether the identity information of the target Internet of things equipment exists in the identity information table or not;
when executing the step of sending the message to be pushed to the target internet of things device through long connection, the long connection server is specifically configured to:
acquiring a target socket which has an incidence relation with the identity identification information of the target Internet of things equipment from the identity information table;
and sending the message to be pushed to the target Internet of things equipment through long connection corresponding to the target socket.
9. A computer device, the computer device comprising: memory, processor and computer program stored on the memory and executable on the processor, characterized in that the processor realizes the steps of the method of any of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
CN202210261298.6A 2022-03-16 2022-03-16 Message pushing method, system, equipment and readable storage medium Pending CN114760297A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210261298.6A CN114760297A (en) 2022-03-16 2022-03-16 Message pushing method, system, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210261298.6A CN114760297A (en) 2022-03-16 2022-03-16 Message pushing method, system, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN114760297A true CN114760297A (en) 2022-07-15

Family

ID=82326316

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210261298.6A Pending CN114760297A (en) 2022-03-16 2022-03-16 Message pushing method, system, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN114760297A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104767775A (en) * 2014-01-06 2015-07-08 腾讯科技(深圳)有限公司 Webpage application information push method and webpage application information push system
CN107770201A (en) * 2017-12-11 2018-03-06 江苏卓尔美物联科技股份有限公司 Message push system and method based on wide area network in a kind of Internet of Things application
CN109547511A (en) * 2017-09-22 2019-03-29 ***通信集团浙江有限公司 A kind of real-time method for pushing of WEB message, server, client and system
CN110417915A (en) * 2019-08-22 2019-11-05 北京大米科技有限公司 A kind of PUSH message transmission method, device, storage medium and electronic equipment
CN110505275A (en) * 2019-07-16 2019-11-26 北京奇艺世纪科技有限公司 Data transmission method, system, server and computer readable storage medium
CN110932924A (en) * 2019-10-28 2020-03-27 深圳市钱海网络技术有限公司 Message pushing method and device for communication between APP and server
CN113407823A (en) * 2021-05-30 2021-09-17 咸宁方片互娱网络有限公司 IOS message pushing method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104767775A (en) * 2014-01-06 2015-07-08 腾讯科技(深圳)有限公司 Webpage application information push method and webpage application information push system
CN109547511A (en) * 2017-09-22 2019-03-29 ***通信集团浙江有限公司 A kind of real-time method for pushing of WEB message, server, client and system
CN107770201A (en) * 2017-12-11 2018-03-06 江苏卓尔美物联科技股份有限公司 Message push system and method based on wide area network in a kind of Internet of Things application
CN110505275A (en) * 2019-07-16 2019-11-26 北京奇艺世纪科技有限公司 Data transmission method, system, server and computer readable storage medium
CN110417915A (en) * 2019-08-22 2019-11-05 北京大米科技有限公司 A kind of PUSH message transmission method, device, storage medium and electronic equipment
CN110932924A (en) * 2019-10-28 2020-03-27 深圳市钱海网络技术有限公司 Message pushing method and device for communication between APP and server
CN113407823A (en) * 2021-05-30 2021-09-17 咸宁方片互娱网络有限公司 IOS message pushing method and system

Similar Documents

Publication Publication Date Title
CN111555963B (en) Message pushing method and device, electronic equipment and storage medium
US20210036907A1 (en) Methods and apparatuses for pushing a message
US8069224B2 (en) Method, equipment and system for resource acquisition
US20160277496A1 (en) Method, server and system for application synchronization
CN103370917B (en) Message treatment method and server
EP3633957A1 (en) Data storage method, storage server, storage medium and system
CN109361525B (en) Method, device, control terminal and medium for restarting distributed deployment of multiple services
CN112052227A (en) Data change log processing method and device and electronic equipment
CN112087475B (en) Message pushing method and device for cloud platform component application and message server
CN114500633B (en) Data forwarding method, related device, program product and data transmission system
US11444998B2 (en) Bit rate reduction processing method for data file, and server
CN110798358B (en) Distributed service identification method and device, computer readable medium and electronic equipment
US9609085B2 (en) Broadcast-based update management
US9852031B2 (en) Computer system and method of identifying a failure
CN110798492B (en) Data storage method and device and data processing system
CN114760297A (en) Message pushing method, system, equipment and readable storage medium
CN113612811B (en) Method, system, equipment and medium for client mounting in multiple channels
CN107704557B (en) Processing method and device for operating mutually exclusive data, computer equipment and storage medium
CN112732728A (en) Data synchronization method and system
KR20160026138A (en) Rapid sync method for cloud file system and cloud file system using the same
CN113301154B (en) Public cloud resource creation method and device, storage medium and electronic equipment
US20140330798A1 (en) VDI File Transfer Method and Apparatus
US9251153B1 (en) Systems and methods for populating and maintaining a local cache with archived data items
CN117914947A (en) Node management method and device based on scheduling analysis
US20130054764A1 (en) Registration Method of CIM Provider in CIM System and CIMOM

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination