CN116599819A - Event notification method, device, computer equipment and storage medium - Google Patents

Event notification method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116599819A
CN116599819A CN202310700586.1A CN202310700586A CN116599819A CN 116599819 A CN116599819 A CN 116599819A CN 202310700586 A CN202310700586 A CN 202310700586A CN 116599819 A CN116599819 A CN 116599819A
Authority
CN
China
Prior art keywords
intelligent gateway
event data
event
receiving end
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
Application number
CN202310700586.1A
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.)
Hangzhou Lifesmart Technology Co ltd
Original Assignee
Hangzhou Lifesmart Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Lifesmart Technology Co ltd filed Critical Hangzhou Lifesmart Technology Co ltd
Priority to CN202310700586.1A priority Critical patent/CN116599819A/en
Publication of CN116599819A publication Critical patent/CN116599819A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • 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/164Adaptation or special uses of UDP protocol

Abstract

The invention relates to the technical field of the Internet of things, and discloses an event notification method, an event notification device, computer equipment and a storage medium, wherein the event notification method is applied to a local area network, the local area network comprises at least one intelligent gateway, and the method comprises the following steps: acquiring intelligent gateway change information; generating a change information event data message based on the intelligent gateway change information; generating an event data packet of an event data message based on a preconfigured intelligent gateway event parameter; and sending the event data packet to a preset receiving end by adopting a UDP protocol. The invention solves the problem that the state change of the intelligent gateway and the subordinate sub-equipment can not be guaranteed to timely and accurately send event data packets to the appointed receiving end and the communication port.

Description

Event notification method, device, computer equipment and storage medium
Technical Field
The invention relates to the technical field of the internet of things, in particular to an event notification method, an event notification device, computer equipment and a storage medium.
Background
Along with the development of the industry of the intelligent internet of things, the requirements of large clients are various, the intelligent gateway of a single manufacturer cannot completely meet the requirements of clients, and a large number of requirements for butt joint in a local area network or an intranet exist in the clients of an integrator. The integration business client thus has one of the needs to interface with the acquisition of the state changes of the intelligent gateway itself and the state changes of its subordinate sub-devices.
The manner of receiving or viewing intelligent gateways commonly used in the existing local area network or intranet in the industry can be basically divided into the following two ways: the first is to query the state information of the intelligent gateway and the subordinate sub-equipment at regular time by a specified protocol instruction, and compare the state information with the original state information list to judge the corresponding state change; the second is to monitor the connected subscription link by using the long link of TCP as the TCP server, and then when the state of the intelligent gateway and the subordinate equipment is changed, the intelligent gateway sends the corresponding state change information to the corresponding third party receiving end through each connected TCP subscription link in time. For the two existing technical modes:
the timeliness and the accuracy of the state change of the first kind are not guaranteed, the change information queried by a third party can not be recorded every time of change, basically only the time interval of timing query can be determined, whether the state of the last time and the original state are changed, the state change and the times in the time interval can not be obtained, or more logic processing and complex scheme design are needed.
The timeliness and accuracy of the second scheme can be guaranteed, but a long-chain link mechanism based on TCP has a relatively complex pre-communication handshake connection operation, connection establishment and completion are waited, a TCP link is required to be designed with a complex protocol to solve the problem of communication packet sticking, and the requirement on the equipment performance of a third party receiving end is higher. And TCP links are one-to-one links, and every more intelligent gateway or receiving end is accessed in local area network or intranet, the connection needs to be re-established.
Disclosure of Invention
In view of this, the present invention provides an event notification method, apparatus, computer device and storage medium, so as to solve the problem that the state change of the intelligent gateway itself and the subordinate sub-devices cannot be guaranteed to timely and accurately send event data packets to the designated receiving end and the communication port.
In a first aspect, the present invention provides an event notification method, applied to a local area network, where the local area network includes at least one intelligent gateway, the event notification method includes:
acquiring intelligent gateway change information;
generating a change information event data message based on the intelligent gateway change information;
generating an event data packet of an event data message based on a preconfigured intelligent gateway event parameter;
and sending the event data packet to a preset receiving end by adopting a UDP protocol.
According to the event notification method provided by the embodiment of the invention, the change information of the intelligent gateway is obtained, the change information event data message is generated based on the change information of the intelligent gateway, the event data packet of the event data message is generated based on the pre-configured event parameters of the intelligent gateway, finally, the event data packet is transmitted to the preset receiving end by adopting the UDP protocol, when the states of the intelligent gateway and subordinate sub-equipment change, the event data packet is finally generated based on the change information of the intelligent gateway and transmitted to the preset receiving end by adopting the UDP protocol, the event data packet can be timely and accurately transmitted to the appointed receiving end and the communication port, and the problem that the state change of the intelligent gateway and the subordinate sub-equipment cannot be timely and accurately transmitted to the appointed receiving end and the communication port is solved.
In an alternative embodiment, before acquiring the intelligent gateway change information, the method further includes:
generating intelligent gateway event parameters; the intelligent gateway event parameters include: the receiving end communication address, the communication port, the message content identification and the encryption parameter.
According to the event notification method provided by the embodiment of the invention, the event data packet is easy to send according to the requirement of the receiving end by generating the event parameters of the intelligent gateway and designating the communication address, the communication port, the message content identifier and the encryption parameters of the receiving end, the requirement of the receiving end user with the requirement on safety is ensured by integrating the encryption parameters, and the user population is expanded.
In an alternative embodiment, the intelligent gateway change information includes: the intelligent gateway itself state attribute changes, the sub-device state attribute changes, the time stamp of the sub-device when it is newly added, the attribution information of the sub-device when it is newly added, the time stamp of the sub-device when it is deleted and the attribution information of the sub-device when it is deleted.
In an alternative embodiment, generating an event data packet for an event data message based on pre-configured intelligent gateway event parameters includes:
generating an event data packet with a preset data format based on a message content identifier and an encryption parameter in the event parameters of the intelligent gateway, wherein the event data packet comprises: message content identification, message function flag, message type, packet body length and packet data content.
According to the event notification method provided by the embodiment of the invention, the event data packet with the preset data format is generated based on the message content identification and the encryption parameter in the event parameters of the intelligent gateway, and the receiving end determines and identifies whether the event data packet is the event notification data packet according to the data format of the event data packet, so that a basis is provided for accurately sending the event data packet to the appointed IP address receiving end and the communication port.
In an alternative embodiment, before the event data packet is sent to the preset receiving end by adopting the UDP protocol, the method further includes:
a heartbeat mechanism is set for the event data packet.
In an alternative embodiment, setting a heartbeat mechanism for an event data packet includes:
acquiring a communication address and a communication port of a preset receiving end in an event data packet;
generating a heartbeat packet based on the communication address and the communication port of the receiving end;
and setting a heartbeat timeout time for the heartbeat packet, and generating a heartbeat message with a heartbeat keep-alive function.
The event notification method provided by the embodiment of the invention sets the heartbeat mechanism for the event data packet, so that the event data packet has the primary heartbeat message with a certain keep-alive heartbeat function, and the effects of the effectiveness of communication between the intelligent gateway and the receiving end and the automatic release of communication resources are realized.
In an optional implementation manner, the sending the event data packet to the preset receiving end by adopting the UDP protocol includes:
and in the heartbeat timeout time, transmitting the event data packet to a preset receiving end pointed by the primary heartbeat message by adopting a UDP protocol.
According to the event notification method provided by the embodiment of the invention, in the time-out of the heartbeat, the event data packet is sent to the preset receiving end pointed by the primary heartbeat message by adopting the UDP protocol, and the event data packet is accurately sent to the appointed IP address receiving end and the communication port, so that the problem that the accuracy of UDP protocol transmission communication in a local area network or an intranet cannot be ensured is solved.
In a second aspect, the present invention provides an event notification apparatus, the apparatus comprising:
the acquisition module is used for acquiring the intelligent gateway change information;
the first generation module is used for generating a change information event data message based on the change information of the intelligent gateway;
the second generation module is used for generating an event data packet of the event data message based on the pre-configured intelligent gateway event parameters;
and the sending module is used for sending the event data packet to a preset receiving end by adopting a UDP protocol.
In a third aspect, the present invention provides a computer device comprising: the processor executes the computer instructions, thereby executing the event notification method according to the first aspect or any of the embodiments thereof.
In a fourth aspect, the present invention provides a computer-readable storage medium having stored thereon computer instructions for causing a computer to execute the event notification method of the first aspect or any of its corresponding embodiments.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow diagram of an event notification method according to an embodiment of the invention;
FIG. 2 is a flow chart of another event notification method according to an embodiment of the invention;
FIG. 3 is a flow chart of yet another event notification method according to an embodiment of the invention;
fig. 4 is a schematic diagram of communication between an intelligent network manager in a lan and multiple receivers in an event notification method according to an embodiment of the present invention;
fig. 5 is a block diagram of a structure of an event notification apparatus according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a hardware structure of a computer device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
According to an embodiment of the present invention, an event notification method embodiment is provided, it being noted that the steps shown in the flowchart of the figures may be performed in a computer system such as a set of computer executable instructions, and, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order other than that shown or described herein.
In this embodiment, an event notification method is provided, which may be applied to a local area network, where the local area network includes at least one intelligent gateway, and fig. 1 is a flowchart of the event notification method according to an embodiment of the present invention, and as shown in fig. 1, the flowchart includes the following steps:
step S101, intelligent gateway change information is obtained. Specifically, when the intelligent gateway itself or its sub-device state attribute changes, a sub-device is newly added, a sub-device is deleted, for example: the intelligent gateway itself changes its network state, a certain switch is turned on or turned off, and a sensor is changed, so that a change message is generated, where the change message may include the changed attribute and state, the changed timestamp, and the change attribution message. Taking the schematic diagram of communication between the intelligent gateway and the multiple receiving ends in the local area network in fig. 4 as an example, the local area network includes a first intelligent gateway, a second intelligent gateway and a third intelligent gateway, and when the network state of the first intelligent gateway changes, the network state change information of the first intelligent gateway is generated; when the second intelligent gateway is added with a sensor device, timestamp information when the second intelligent gateway is added with the sensor device and attribution information when the second intelligent gateway is added with the sensor device are generated; when the third intelligent gateway deletes one piece of sub-equipment, timestamp information when the third intelligent gateway deletes the sub-equipment and attribution information when the third intelligent gateway deletes the sub-equipment are generated.
Step S102, generating a change information event data message based on the intelligent gateway change information. Specifically, when the intelligent gateway changes, an event data message is generated based on the intelligent gateway change information, as shown in fig. 4, when the network state of the first intelligent gateway changes, first intelligent gateway network state change information is generated, and the first intelligent gateway network state change event data message is generated based on the first intelligent gateway network state change information; when a sensor device is newly added to the second intelligent gateway, timestamp information when the sensor device is newly added to the second intelligent gateway and attribution information when the sensor device is newly added to the second intelligent gateway are generated, and a timestamp and attribution information event data message when the sensor device is newly added to the second intelligent gateway are generated based on the timestamp information when the sensor device is newly added to the second intelligent gateway and attribution information when the sensor device is newly added to the second intelligent gateway; when the third intelligent gateway deletes one piece of sub-equipment, timestamp information when the third intelligent gateway deletes the sub-equipment and attribution information when the third intelligent gateway deletes the sub-equipment are generated, and a timestamp and attribution information event data message when the third intelligent gateway deletes the sub-equipment are generated based on the timestamp information when the third intelligent gateway deletes the sub-equipment and attribution information when the third intelligent gateway deletes the sub-equipment.
Step S103, generating an event data packet of the event data message based on the preconfigured intelligent gateway event parameters. Specifically, as shown in fig. 4, the local area network further includes a preset receiving end, where the preset receiving end includes a first receiving end, a second receiving end, a third receiving end, a fourth receiving end, a first encryption module and a second encryption module. The first encryption module is connected with the second intelligent gateway; the second encryption module is connected with the third intelligent gateway.
The pre-configured intelligent gateway event parameters may be: the method comprises the steps of sending an unencrypted event to a first receiving end, a second receiving end and a third receiving end, sending an encrypted event to the second receiving end and the fourth receiving end, and sending contents such as specific message content identification messages to the fourth receiving end. For example: and generating event data packets which are not encrypted by the first receiving end, the second receiving end and the third receiving end based on the change information event data messages of the intelligent gateway for the first receiving end, the second receiving end and the third receiving end to send the event parameters of the intelligent gateway which are not encrypted. And encrypting the change information event data message of the intelligent gateway by the first encryption module based on the event parameters of the intelligent gateway for transmitting the encryption event to the third receiving end, and generating an event data packet encrypted by the third receiving end. And generating event data packets of the second receiving end and the fourth receiving end for sending encryption events and sending specific message content identification messages for the fourth receiving end after the change information event data messages of the intelligent gateway are encrypted by the second encryption module based on the event parameters of the intelligent gateway for sending the encryption events for the second receiving end and the fourth receiving end and sending specific message content identification messages for the fourth receiving end.
Step S104, the event data packet is sent to a preset receiving end by adopting UDP protocol. Specifically, as shown in fig. 4, the local area network further includes a first sending module, a second sending module, and a third sending module; the first sending module is respectively connected with the first intelligent gateway, the first receiving end, the second receiving end and the third receiving end; the second sending module is respectively connected with the first encryption module and the third receiving end; the third sending module is respectively connected with the second receiving end, the fourth receiving end and the second encryption module. The UDP protocol is a short for User Datagram Protocol, known as the user datagram protocol, a connectionless transport layer protocol in the OSI (Open System Interconnection, open systems interconnection) reference model.
When the first sending module receives event data packets which are not encrypted by the first receiving end, the second receiving end and the third receiving end, the event data packets which are not encrypted by the first receiving end, the second receiving end and the third receiving end are respectively sent to the first receiving end, the second receiving end and the third receiving end by adopting a UDP protocol. And when the second sending module receives the event data packet encrypted by the third receiving end of the first encryption module, the event data packet is sent to the third receiving end. When the third sending module receives the second receiving end and the fourth receiving end of the second encryption module, the third sending module sends encryption events and event data packets of specific message content identification messages for the fourth receiving end, the event data packets are respectively sent to the second receiving end and the fourth receiving end.
For example: when the electric quantity value of the electric meter equipment subordinate to the intelligent gateway of the equipment manufacturer is increased, when the intelligent gateway receives the state change reported by the electric meter equipment, an event data message of a corresponding sub-equipment state (new electric quantity value) is generated, and then the event data message is sent to the communication address and the communication port of the configured event receiving end (local area network server main body) of the intelligent gateway according to the system integrator, so that all the configured receiving ends (system integrator service points) can synchronously display the new electric quantity data as pages, record histories, calculate electric quantity consumption in time and other subsequent applications.
According to the event notification method provided by the embodiment of the invention, the change information of the intelligent gateway is obtained, the change information event data message is generated based on the change information of the intelligent gateway, the event data packet of the event data message is generated based on the pre-configured event parameters of the intelligent gateway, finally, the event data packet is transmitted to the preset receiving end by adopting the UDP protocol, when the states of the intelligent gateway and subordinate sub-equipment change, the event data packet is finally generated based on the change information of the intelligent gateway and transmitted to the preset receiving end by adopting the UDP protocol, the event data packet can be timely and accurately transmitted to the appointed receiving end and the communication port, and the problem that the state change of the intelligent gateway and the subordinate sub-equipment cannot be timely and accurately transmitted to the appointed receiving end and the communication port is solved.
In this embodiment, an event notification method is provided, which may be applied to a local area network, where the local area network includes at least one intelligent gateway, and fig. 2 is a flowchart of the event notification method according to an embodiment of the present invention, and as shown in fig. 2, the flowchart includes the following steps:
step S200, generating intelligent gateway event parameters; the intelligent gateway event parameters include: the receiving end communication address, the communication port, the message content identification and the encryption parameter. Specifically, generating the event parameters of the intelligent gateway refers to pre-configuring event parameters to set different requirements of each receiving end in the event notification service of the intelligent gateway. The event parameter configuration comprises the following steps:
receiving end communication address and communication port: the communication address of the receiving end, that is, the IP address of the receiving end, and the communication address and the communication port of the receiving end are used for specifying the IP address and the communication port to be sent to the target receiving end in the UDP protocol transmission, which are necessary parameters for UDP protocol communication.
The message content identifiers are divided into BL and JL, and the message content identifiers are used for specifying the data types of the data message text. BL represents that plaintext after decryption of the packet data content is binary character stream, JL represents that plaintext after decryption of the packet data content is JSON (JavaScript Object Notation, a lightweight data exchange format) format character string, BL is suitable for a receiving end of a small-sized real-time operating system, basically belongs to C language writing receiving application, JL is suitable for a receiving end of a medium-sized and large-sized operating system, can write receiving application by using multiple high-level languages or scripting languages, and can be determined by event parameter configuration.
Encryption parameters include whether to encrypt, type of encryption, encryption key, etc., for use by clients in local area network or intranet communication that require security, due to the event notification service, and the requirement for timeliness, symmetric encryption algorithms are used, with faster encryption speeds, such as DES (Data Encryption Standard, data encryption standard, a block algorithm that uses key encryption), AES (Advanced Encryption Standard ), etc.
The event parameter configuration is stored in the intelligent gateway, and each receiving end has its own corresponding configuration, and when the event notification service is started, the event parameters of each receiving end need to be configured or modified by the security mode interface and stored.
Step S201, intelligent gateway change information is acquired. The intelligent gateway change information includes: the intelligent gateway itself state attribute changes, the sub-device state attribute changes, the time stamp of the sub-device when it is newly added, the attribution information of the sub-device when it is newly added, the time stamp of the sub-device when it is deleted and the attribution information of the sub-device when it is deleted. Please refer to step S101 in the embodiment shown in fig. 1 in detail, which is not described herein.
Step S202, generating a change information event data message based on the intelligent gateway change information. Please refer to step S102 in the embodiment shown in fig. 1 in detail, which is not described herein.
Step S203, generating an event data packet of the event data packet based on the preconfigured intelligent gateway event parameters.
Specifically, the step S203 includes:
generating an event data packet with a preset data format based on a message content identifier and an encryption parameter in the event parameters of the intelligent gateway, wherein the event data packet comprises: message content identification, message function flag, message type, packet body length and packet data content.
The content of the preset data format is as follows: contains a message content identifier (2 bytes), a message function identifier (2 bytes), a message type (2 bytes), a packet body length (4 bytes), and a packet data content (the number of data bytes is determined by the packet body length).
The message content identifier comprises BL and JL, wherein BL represents that plaintext after decryption of the packet data content is binary character stream, JL represents that plaintext after decryption of the packet data content is JSON format character string, BL is suitable for a receiving end of a small-sized real-time operating system, basically belongs to C language writing receiving application, JL is suitable for a receiving end of a medium-sized and large-sized operating system, can write receiving application by using multiple high-level languages or scripting languages, and can be determined by event parameter configuration.
The message function flag indicates whether the data message has an extended function, e.g., whether it is encrypted, bit0 is 1 indicating encryption, and 0 is unencrypted. Other bits may be available for subsequent extended functions.
The event message type is a fixed value, and the rule 9 represents an event notification message and the rule 3 represents a heartbeat message.
The length of the package text is used for determining the receiving quantity of the data text and judging whether the data package text is correct and complete.
The packet data content includes event data for a single device state change, and if encrypted in the event parameter configuration, decryption operations are required.
Step S204, the event data packet is sent to the preset receiving end by adopting UDP protocol. Please refer to step S104 in the embodiment shown in fig. 1 in detail, which is not described herein.
According to the event notification method provided by the embodiment of the invention, the event data packet is easy to send according to the requirement of the receiving end by generating the event parameters of the intelligent gateway and designating the communication address, the communication port, the message content identifier and the encryption parameters of the receiving end, the requirement of the receiving end user with the requirement on safety is ensured by integrating the encryption parameters, and the user population is expanded. Based on the message content identification and encryption parameters in the event parameters of the intelligent gateway, an event data packet with a preset data format is generated, and a receiving end determines and identifies whether the event data packet is an event notification data packet according to the data format of the event data packet, so that a basis is provided for accurately sending the event data packet to a designated IP address receiving end and a communication port.
In this embodiment, an event notification method is provided, which may be used in the above mobile terminal, such as a mobile phone, a tablet computer, etc., and fig. 3 is a flowchart of the event notification method according to an embodiment of the present invention, as shown in fig. 3, where the flowchart includes the following steps:
step S301, obtaining intelligent gateway variation information. Please refer to step S101 in the embodiment shown in fig. 1 in detail, which is not described herein.
Step S302, a change information event data message is generated based on the intelligent gateway change information. Please refer to step S202 in the embodiment shown in fig. 2, which is not described herein.
Step S303, generating an event data packet of the event data message based on the preconfigured intelligent gateway event parameters. Please refer to step S203 in the embodiment shown in fig. 2 in detail, which is not described herein.
Step S304, a heartbeat mechanism is set for the event data packet.
Specifically, step S304 includes:
step S3041, obtaining a preset receiving end communication address and communication port in the event data packet. Specifically, since the UDP protocol has no connectivity, in order to reduce the occupation of invalid resources, a heartbeat mechanism is required to ensure the validity of communication when the UDP protocol is used for communication. The preset receiving end communication address and communication port need to be obtained from the event data packet. For example: the event data packet is an event data packet encrypted by the third receiving end, and the communication address of the third receiving end and the communication interface of the third receiving end are to be obtained from the event data packet.
Step S3042, generating a heartbeat packet based on the communication address and the communication port of the receiving end. Specifically, after the communication address and the communication port of the receiving end are obtained from the event data packet, the heartbeat packet is generated from the communication address and the communication port of the receiving end according to the data packet format of the heartbeat mechanism. For example: and when the event data packet is an event data packet encrypted by the third receiving end, after the communication address of the third receiving end and the communication port of the third receiving end are obtained, generating a heartbeat packet of the communication address of the third receiving end and the communication port of the third receiving end according to a data packet format of a heartbeat mechanism.
Step S3043, setting a heartbeat timeout time for the heartbeat packet, and generating a primary heartbeat message with a heartbeat keep-alive function. Specifically, the heartbeat mechanism needs a heartbeat timeout time parameter to generate a heartbeat message, and the type of the heartbeat message is 3. The heartbeat message of the heartbeat mechanism is only used as a keep-alive mechanism, so that the data text is not encrypted, and only contains two information of the communication address and the communication port of the receiving end, so that the receiving monitoring of the corresponding receiving end of the heartbeat message is proved to exist, and the event data packet is not invalid to be sent.
In step S305, the event data packet is sent to the preset receiving end by using UDP protocol. Specifically, in the time-out of the heartbeat, when the intelligent gateway generates a change event, the UDP protocol is adopted to send the event data packet with the heartbeat message to the receiving end pointed by the current heartbeat keep-alive, so that the event data packet can be ensured to be accurately sent after the current heartbeat keep-alive. When the heartbeat timeout time is exceeded and no new heartbeat message exists in the heartbeat timeout time, the intelligent gateway releases the event message and the event data packet related to the change information, and no event data packet is sent to the receiving end without heartbeat keep-alive, so that the effectiveness of UDP protocol communication and automatic release of communication resources are realized.
For example: as shown in fig. 4, when the event data packet is an event data packet that is not encrypted by the first receiving end, the second receiving end, and the third receiving end, a heartbeat keep-alive is provided for the first receiving end, the second receiving end, and the third receiving end through a heartbeat message, a heartbeat timeout time is set to be 100ms, and within 100ms, the event data packet that is not encrypted by the first receiving end, the second receiving end, and the third receiving end is sent to the first receiving end, the second receiving end, and the third receiving end respectively by adopting a UDP protocol, and if the event data packet exceeds 100ms, no new heartbeat message is provided, the intelligent gateway will release the event message related to the change information and the related event data packet.
The event notification method provided by the embodiment of the invention sets the heartbeat mechanism for the event data packet, so that the event data packet has the primary heartbeat message with a certain keep-alive heartbeat function, and the effects of the effectiveness of communication between the intelligent gateway and the receiving end and the automatic release of communication resources are realized.
The embodiment also provides an event notification device, which is used for implementing the above embodiment and the preferred implementation manner, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
The present embodiment provides an event notification apparatus, as shown in fig. 5, including:
an obtaining module 501, configured to obtain intelligent gateway change information;
a first generating module 502, configured to generate a change information event data packet based on the change information of the intelligent gateway;
a second generating module 503, configured to generate an event data packet of the event data packet based on a preconfigured intelligent gateway event parameter;
the sending module 504 is configured to send the event data packet to a preset receiving end by using a UDP protocol.
In some alternative embodiments, the event notification apparatus further comprises:
the third generation module is used for generating intelligent gateway event parameters; the intelligent gateway event parameters include: the receiving end communication address, the communication port, the message content identification and the encryption parameter.
The setting module is used for setting a heartbeat mechanism for the event data packet.
In some alternative embodiments, the setting module includes:
the acquisition unit is used for acquiring a communication address and a communication port of a preset receiving end in the event data packet;
the first generation unit is used for generating a heartbeat packet based on the communication address and the communication port of the receiving end;
the second generating unit is used for setting a heartbeat timeout time for the heartbeat packet and generating a heartbeat message with a heartbeat keep-alive function.
Further functional descriptions of the above respective modules and units are the same as those of the above corresponding embodiments, and are not repeated here.
The event notification apparatus in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit ) circuit, a processor and a memory executing one or more software or fixed programs, and/or other devices that can provide the above-described functions.
The embodiment of the invention also provides a computer device which is provided with the event notification device shown in the figure 5.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a computer device according to an alternative embodiment of the present invention, as shown in fig. 6, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are communicatively coupled to each other using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the computer device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In some alternative embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple computer devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 10 is illustrated in fig. 6.
The processor 10 may be a central processor, a network processor, or a combination thereof. The processor 10 may further include a hardware chip, among others. The hardware chip may be an application specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general-purpose array logic, or any combination thereof.
Wherein the memory 20 stores instructions executable by the at least one processor 10 to cause the at least one processor 10 to perform the methods shown in implementing the above embodiments.
The memory 20 may include a storage program area that may store an operating system, at least one application program required for functions, and a storage data area; the storage data area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, memory 20 may optionally include memory located remotely from processor 10, which may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk, or solid state disk; the memory 20 may also comprise a combination of the above types of memories.
The computer device also includes a communication interface 30 for the computer device to communicate with other devices or communication networks.
The embodiments of the present invention also provide a computer readable storage medium, and the method according to the embodiments of the present invention described above may be implemented in hardware, firmware, or as a computer code which may be recorded on a storage medium, or as original stored in a remote storage medium or a non-transitory machine readable storage medium downloaded through a network and to be stored in a local storage medium, so that the method described herein may be stored on such software process on a storage medium using a general purpose computer, a special purpose processor, or programmable or special purpose hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, a solid state disk or the like; further, the storage medium may also comprise a combination of memories of the kind described above. It will be appreciated that a computer, processor, microprocessor controller or programmable hardware includes a storage element that can store or receive software or computer code that, when accessed and executed by the computer, processor or hardware, implements the methods illustrated by the above embodiments.
Although embodiments of the present invention have been described in connection with the accompanying drawings, various modifications and variations may be made by those skilled in the art without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope of the invention as defined by the appended claims.

Claims (10)

1. An event notification method, applied to a local area network, where the local area network includes at least one intelligent gateway, the method comprising:
acquiring intelligent gateway change information;
generating a change information event data message based on the intelligent gateway change information;
generating an event data packet of the event data message based on a preconfigured intelligent gateway event parameter;
and transmitting the event data packet to a preset receiving end by adopting a UDP protocol.
2. The method of claim 1, further comprising, prior to obtaining the intelligent gateway change information:
generating intelligent gateway event parameters; the intelligent gateway event parameters include: the receiving end communication address, the communication port, the message content identification and the encryption parameter.
3. The method of claim 1, wherein the intelligent gateway change information comprises: the intelligent gateway itself state attribute changes, the sub-device state attribute changes, the time stamp of the sub-device when it is newly added, the attribution information of the sub-device when it is newly added, the time stamp of the sub-device when it is deleted and the attribution information of the sub-device when it is deleted.
4. The method of claim 2, wherein generating the event data packet of the event data message based on the pre-configured intelligent gateway event parameters comprises:
generating an event data packet with a preset data format based on the message content identification and the encryption parameter in the intelligent gateway event parameter, wherein the event data packet comprises: message content identification, message function flag, message type, packet body length and packet data content.
5. The method according to claim 1, further comprising, before said transmitting said event data packet to a predetermined receiving end using UDP protocol:
and setting a heartbeat mechanism for the event data packet.
6. The method of claim 5, wherein setting a heartbeat mechanism for the event data packet comprises:
acquiring a communication address and a communication port of a preset receiving end in the event data packet;
generating a heartbeat packet based on the communication address and the communication port of the receiving end;
and setting a heartbeat timeout time for the heartbeat packet, and generating a heartbeat message with a heartbeat keep-alive function.
7. The method of claim 6, wherein the sending the event data packet to the predetermined receiving end using UDP protocol comprises:
and in the heartbeat timeout time, adopting a UDP protocol to send the event data packet to a preset receiving end pointed by the primary heartbeat message.
8. An event notification apparatus, the apparatus comprising:
the acquisition module is used for acquiring the intelligent gateway change information;
the first generation module is used for generating a change information event data message based on the change information of the intelligent gateway;
the second generation module is used for generating an event data packet of the event data message based on the pre-configured intelligent gateway event parameters;
and the sending module is used for sending the event data packet to a preset receiving end by adopting a UDP protocol.
9. A computer device, comprising:
a memory and a processor in communication with each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the event notification method of any of claims 1 to 7.
10. A computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the event notification method of any of claims 1 to 7.
CN202310700586.1A 2023-06-13 2023-06-13 Event notification method, device, computer equipment and storage medium Pending CN116599819A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310700586.1A CN116599819A (en) 2023-06-13 2023-06-13 Event notification method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310700586.1A CN116599819A (en) 2023-06-13 2023-06-13 Event notification method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116599819A true CN116599819A (en) 2023-08-15

Family

ID=87599170

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310700586.1A Pending CN116599819A (en) 2023-06-13 2023-06-13 Event notification method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116599819A (en)

Similar Documents

Publication Publication Date Title
US11082421B2 (en) Bootstrap mechanism for endpoint devices
WO2021121370A1 (en) Message loss detection method and apparatus for message queue
WO2020135575A1 (en) System and method for obtaining network topology, and server
CN110300050A (en) Information push method, device, computer equipment and storage medium
US11025724B2 (en) Transport of control data in proxy-based network communications
CN106790420B (en) A kind of more session channel method for building up and system
CN111083161A (en) Data transmission processing method and device and Internet of things equipment
CN110769009B (en) User identity authentication method and system
WO2021022794A1 (en) Rdma-based data transmission method, network card, server and medium
CN109246172A (en) A kind of method, apparatus and computer storage medium for restoring session
WO2022062407A1 (en) Link monitoring method and apparatus, and storage medium and electronic apparatus
WO2017000572A1 (en) Internet content adaptation protocol-based communication method, client and server
US8656013B2 (en) Real-time data monitoring based on data push
EP3970016A1 (en) Control configuration for a plurality of endpoint devices
CN111352602A (en) Control method, device and equipment of LED screen and storage medium
WO2017005118A1 (en) Method, device, terminal and server for maintaining communication connection
CN109714337B (en) Data encryption transmission method and equipment
CN111866060A (en) TLS (transport layer service) connection method of communication equipment, communication equipment and communication system
CN116599819A (en) Event notification method, device, computer equipment and storage medium
Tanganelli et al. A distributed architecture for discovery and access in the internet of things
WO2016127634A1 (en) Service processing method, device and system for application program, and storage medium
CN112118284A (en) Gateway device-oriented http data request method, device and medium
EP4216527A1 (en) Apparatus, method and program for transmitting and receiving data to and from iot device
CN111343261A (en) Mobile phone data backup method based on wireless hotspot transmission
TWI778771B (en) Monitoring method, monitoring system and monitoring device of virtual machine operation

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