CN110808950B - Message processing method, device, computer equipment and storage medium - Google Patents
Message processing method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN110808950B CN110808950B CN201910911094.0A CN201910911094A CN110808950B CN 110808950 B CN110808950 B CN 110808950B CN 201910911094 A CN201910911094 A CN 201910911094A CN 110808950 B CN110808950 B CN 110808950B
- Authority
- CN
- China
- Prior art keywords
- message
- identifier
- internet
- things
- preset
- 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.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 23
- 238000012545 processing Methods 0.000 claims abstract description 29
- 238000000034 method Methods 0.000 claims abstract description 22
- 238000004590 computer program Methods 0.000 claims description 29
- 238000004458 analytical method Methods 0.000 claims description 8
- 230000008569 process Effects 0.000 abstract description 7
- 238000010586 diagram Methods 0.000 description 10
- 230000004044 response Effects 0.000 description 9
- 230000005540 biological transmission Effects 0.000 description 6
- 230000006870 function Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 3
- 229940102240 option 2 Drugs 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/12—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/26—Special purpose or proprietary protocols or architectures
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Computer And Data Communications (AREA)
Abstract
The application relates to a message processing method, a message processing device, computer equipment and a storage medium. The method comprises the following steps: receiving an Internet of things message sent by a second terminal, and analyzing the Internet of things message to obtain a message identifier in the Internet of things message; determining the message type of the message of the Internet of things according to the message identifier; and executing corresponding preset operation according to the message type. By adopting the scheme, the judgment process of the message type of the Internet of things can be simplified, and the message processing efficiency of the Internet of things is improved.
Description
Technical Field
The present application relates to the field of internet of things technology, and in particular, to a message processing method and apparatus, a computer device, and a storage medium.
Background
With the development of computer technology, the development of internet of things is driven, and the internet of things technology refers to the functions of connecting an object with a network through information sensing equipment according to an agreed protocol, and performing information exchange and communication through an information transmission medium so as to realize intelligent identification, positioning, tracking, supervision and the like. The application scenes of the Internet of things comprise application scenes of smart home, building automation, industrial automation and the like.
LwM2M (Lightweight M2M) is a Protocol of a Lightweight Application layer, is mainly used for various Internet of things devices, and realizes Internet of things messaging based on a restricted Application Protocol (CoaP Protocol), however, in the current Internet of things message processing process, the message type judgment process of the Internet of things messages is complex and is prone to errors.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a message processing method, an apparatus, a computer device, and a storage medium, which can improve message processing efficiency of the internet of things.
A message processing method is applied to a first terminal, and comprises the following steps:
receiving an internet of things message sent by a second terminal;
analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
determining the message type of the message of the Internet of things according to the message identifier;
and executing corresponding preset operation according to the message type.
In one embodiment, the internet of things message is a user datagram protocol based internet of things message.
In one embodiment, the internet of things message based on the user datagram protocol comprises a CoaP message.
In one embodiment, the determining the message type of the internet of things message according to the message identifier includes:
acquiring a first identifier and a second identifier of the message identifier, wherein the first identifier corresponds to at least one second identifier; the first identification is used for representing a protocol type; the second identification is used for representing the type of the message;
and determining the message type of the message of the Internet of things according to the first identifier and the second identifier.
In one embodiment, the first identifier is a preset first identifier; the determining the message type of the internet of things message according to the first identifier and the second identifier includes:
searching a preset second identifier corresponding to a first identifier from a corresponding relation between the preset first identifier and the preset second identifier;
comparing the second identifier with the preset second identifier;
and when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things.
A message processing apparatus, the apparatus comprising:
the receiving module is used for receiving the Internet of things message sent by the second terminal;
the analysis module is used for analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
The determining module is used for determining the message type of the message of the Internet of things according to the message identifier;
and the execution module is used for executing corresponding preset operation according to the message type.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
receiving an internet of things message sent by a second terminal;
analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
determining the message type of the message of the Internet of things according to the message identifier;
and executing corresponding preset operation according to the message type.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
receiving an Internet of things message sent by a second terminal;
analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
determining the message type of the message of the Internet of things according to the message identifier;
and executing corresponding preset operation according to the message type.
The message processing method, the message processing device, the computer equipment and the storage medium receive the message of the internet of things sent by the second terminal; analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things, and determining the message type of the message of the Internet of things according to the message identifier; each message identifier corresponds to one message type, when the type of the internet of things message is judged, only the message identifier in the internet of things message needs to be analyzed and obtained, the message type of the internet of things message can be determined by simply judging according to the message identifier, and further complex judgment on other data carried in the internet of things message is not needed; and executing corresponding preset operation according to the message type, accurately and quickly judging the type of the message of the Internet of things according to the message identifier when receiving a plurality of messages of the Internet of things, and executing the preset operation corresponding to each message type according to the message type, thereby improving the processing efficiency and accuracy of the message of the Internet of things.
A message processing method is applied to a second terminal, and comprises the following steps:
acquiring an internet of things message to be sent;
adding a message identifier to the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the to-be-sent internet of things message;
and sending the message of the Internet of things containing the message identifier to the first terminal.
In one embodiment, the message identifier includes a first identifier and a second identifier, the first identifier is used for indicating a protocol type, and the second identifier is used for indicating a message type.
A message processing apparatus, the apparatus comprising:
the acquisition module is used for acquiring the message of the Internet of things to be sent;
the adding module is used for adding a message identifier into the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the to-be-sent internet of things message;
and the sending module is used for sending the Internet of things message containing the message identifier to the first terminal.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
Acquiring an internet of things message to be sent;
adding a message identifier to the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the to-be-sent internet of things message;
and sending the Internet of things message containing the message identifier to the first terminal.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring an internet of things message to be sent;
adding a message identifier in the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the to-be-sent internet of things message;
and sending the message of the Internet of things containing the message identifier to the first terminal.
According to the message processing method, the message processing device, the computer equipment and the storage medium, the message of the Internet of things to be sent is acquired; the message identification is added to the to-be-sent message of the internet of things to obtain the message of the internet of things containing the message identification, wherein the message identification is used for determining the message type of the to-be-sent message of the internet of things, the message of the internet of things containing the message identification is sent to the first terminal, the message identification is added to the message of the internet of things, different target messages can be distinguished according to the message identification, and the message type judgment efficiency of the message of the internet of things is improved.
Drawings
FIG. 1 is a diagram of an application environment of a message processing method in one embodiment;
FIG. 2 is a flow diagram that illustrates a method for message processing in one embodiment;
fig. 3 is a schematic flow chart illustrating a message type determination step of the internet of things in one embodiment;
FIG. 4 is a flow chart illustrating a message processing method according to another embodiment;
FIG. 5 is an architecture diagram of the lightweight M2M protocol in the message processing method of one embodiment;
FIG. 6 is a flow diagram that illustrates a method for message processing in one embodiment;
FIG. 7 is a block diagram showing the structure of a message processing apparatus according to an embodiment;
FIG. 8 is a block diagram showing the construction of a message processing apparatus according to another embodiment;
FIG. 9 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
The message processing method provided by the application can be applied to the application environment shown in fig. 1. Wherein the first terminal 102 communicates with the second terminal 104 via a network. The first terminal 102 receives the internet of things message sent by the second terminal 104, analyzes the internet of things message to obtain a message identifier in the internet of things message, determines a message type of the internet of things message according to the message identifier, and the terminal 102 executes corresponding preset operation according to the message type. The first terminal 102 may be, but is not limited to, various personal computers, laptops, smartphones, tablets and portable wearable devices, and the second terminal 104 may be, but is not limited to, various personal computers, notebooks, smartphones, tablets and portable wearable devices.
It is to be understood that the terms "first," "second," and the like as used herein may be used herein to describe various terminals, but these terminals are not limited by these terms. These terms are only used to distinguish a first terminal from another terminal. For example, a first terminal can be termed a second terminal, and, similarly, a second terminal can be termed a first terminal, without departing from the scope of the present application. The first terminal and the second terminal are both terminals, but they are not the same terminal.
In an embodiment, as shown in fig. 2, a message processing method is provided, which is described by taking the application of the method to the first terminal 102 in fig. 1 as an example, and includes the following steps:
Wherein,. The terminal may be various personal computers, notebook computers, smart phones, tablet computers, portable wearable devices, and the like, and the type of the terminal is not limited herein.
The message of the internet of things is interactive data transmitted based on a network application layer protocol. The internet of things message of the network application layer protocol is transmitted between the two terminals based on the communication protocol. The message of the internet of things is transmitted in a protocol format, the message of the internet of things comprises a message header and a message body, and the message header can comprise a protocol version number (Ver), a message type (T) of an application layer protocol, a function Code (Code), a Token, a message option (Options) and the like; wherein the length of the protocol version number can be 2 bits; the length of the message type of the protocol can be 2 bits; the length of Token may be 4 bits; the length of the function code is 8 bits, and the function code is divided into a first 3bit and a second 5bit, wherein the first 3bit represents the type, 0 represents a null message or a request code, and 2 the beginning represents a response code; the message types of the application layer protocol comprise an acknowledgement request CON, a NON-acknowledgement request NON, a response message ACK and a reset RST; the function codes comprise GET, PUT, POST and DELETE, and can realize the data check, change, addition and deletion of the server or the terminal. The message Options may include multiple Options, a Uniform Resource Identifier (URI), a CoAP host, a request parameter, a load type, and the like may be set in the Options, and the formats of the Options are a combination of "Tag + Length + Value", where Tag represents a number of the Option, Length represents a set byte Length, which may be 1 byte, and Value represents a set Value of the Option; the message body comprises a load (Payload), the load carries actual data content of the internet of things message, and when carrying data, a 16-system carrying mark OxFF needs to be added in front of the data. The message types of the internet of things comprise messages such as observer, discover, Read, Write, Execute, Parameter, Notify and the like.
In one embodiment, the message options of the message of the internet of things include a plurality of options, and each Option may be arranged according to the number of the Option in the message of the internet of things, for example, the number of the Option1 in the message Option of the message of the internet of things is 15, the number of the Option2 is 10, the number of the Option3 is 20, and the arrangement sequence of the Option1, the Option2, and the Option3 is the Option2, the Option1, and the Option 3. And the options are arranged in the number of the message of the Internet of things. The method can avoid conveniently searching the Option data and avoiding data loss.
And 204, analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things.
The message identifier is a unique identifier for distinguishing message types, and different message identifiers corresponding to different message types are used. The message identification can be a number combination of binary 0 and 1, or a number and/or letter combination of 16-ary 0-F, and the like. The message types of the internet of things include observer, discover, Read, Write, Execute, Parameter, and Notify, for example, 0001 may represent the observer message, 0010 may represent the discover message, and 0011 may represent the Read message.
Specifically, the transmission of the message of the internet of things is realized through a format corresponding to an application layer protocol in the transmission process, and after the first terminal receives the message of the internet of things, the received message of the internet of things is analyzed through an analysis packet, so that a message identifier in a message option in a message header of the message of the internet of things is obtained.
In one embodiment, the message of the internet of things is encrypted through an encryption protocol at a network transmission layer, the first terminal triggers an ecdh _ pre _ master _ secret () function to generate a secret key after passing through identity verification through an authentication mechanism in a cache, the encrypted message of the internet of things is decrypted through the secret key, the decrypted message of the internet of things is analyzed, and a message identifier of a message option in the message of the internet of things is obtained. The encryption protocol may be a packet Transport Layer Security (DTLS), and the DTLS is based on a user data protocol for transmission.
And step 206, determining the message type of the Internet of things according to the message identifier.
In particular, different message identities represent different message types, e.g. the identity "0001" represents the Observe message and "0100" represents the Read message.
And step 208, executing corresponding preset operation according to the message type.
Specifically, different message types correspond to different preset operations, the message identifier is obtained by analyzing the message of the internet of things through the data analysis packet, and the program is triggered to execute the preset operation corresponding to the message type according to the message type corresponding to the message identifier. The different message types correspond to different types of preset operations, for example, the message types of the internet of things include observer, discover, Read, Write, Execute, Parameter, Notify, and the like, where the preset operation corresponding to the observer includes a request start operation, a request cancel operation, and a response operation, the preset operation of the discover includes a request operation and a response operation, the preset operation of the Read includes a request operation and a response operation, the preset operation of the Write includes a request operation and a response operation, the preset operation of the Execute includes a request operation and a response operation, the preset operation of the Parameter includes a request operation and a response operation, and the preset operation of the Notify includes a report operation.
In one embodiment, a first terminal is connected with a second terminal through a network, the first terminal receives an internet of things message of the second terminal, a message identifier in a message option of the internet of things message is analyzed through an analysis packet, the type of the internet of things message determined according to the message identifier is Read temperature reading request operation, the first terminal responds to the Read request operation, and response data is returned in the form of the internet of things message through the network.
In the message processing method, the message of the internet of things sent by the second terminal is received; analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things, and determining the message type of the message of the Internet of things according to the message identifier; each message identifier corresponds to one message type, when the type of the internet of things message is judged, only the message identifier in the internet of things message needs to be analyzed and obtained, the message type of the internet of things message can be determined by simply judging according to the message identifier, and further complex judgment on other data carried in the internet of things message is not needed; and executing corresponding preset operation according to the message type, accurately and quickly judging the type of the message of the Internet of things according to the message identifier when receiving a plurality of messages of the Internet of things, and executing the preset operation corresponding to each message type according to the message type, thereby improving the processing efficiency and accuracy of the message of the Internet of things.
In one embodiment, the internet of things message is a user datagram protocol based internet of things message.
The User Datagram Protocol (UDP) is a simple connectionless-oriented and unreliable Datagram transport layer (transport layer) Protocol, and internet-of-things messages based on the UDP do not need to be connected before being sent and after being sent, so that overhead and message sending delay are reduced.
In one embodiment, the internet of things message based on the user datagram protocol comprises a CoaP message.
The restricted Application Protocol (CoaP) message is transmitted based on the UDP Protocol, the CoaP Protocol is a complete binary Application Protocol, the CoaP Protocol has a message header, and a Payload (Payload) and the message header are isolated by using a single-byte separator 0 xFF. The CoaP protocol version number Ver, the label length indication TKL, the standard Code and the Message sequence number Message ID in the Message header are necessary filling parts, and the CoAP load can comprise different media types: binary, text, Extensible Markup Language (XML), JS Object Notation (JSON), CBOR, and the like.
Specifically, a CoaP message sent by the second terminal is received, the CoaP message is analyzed through a message analysis packet, a message identifier in message option Options in the CoaP message is obtained, and the message type of the CoaP message is determined according to the obtained message identifier, wherein the message type of the CoaP message comprises an oven, a discover, a Read, a Write, an Execute, a Parameter, a Notify and the like; and executing corresponding preset operation according to the message type, acquiring the message identifier in the CoaP message through analysis, directly determining the message type by the message identifier, and improving the processing efficiency of the message of the Internet of things without performing complicated judgment on the message type.
In an embodiment, as shown in fig. 3, a message type determining step of an internet of things message is provided, which is described by taking the method as an example applied to the first terminal 102 in fig. 1, and includes the following steps:
The message identifier is a unique identifier for distinguishing message types, and different message identifiers corresponding to different message types are used. The message identification can be a number combination of binary 0 and 1, or a number-letter combination of 16-system 0-F, and the like. The message identifier includes a first identifier and a second identifier, the first identifier is used for representing the protocol type, and the second identifier is used for representing the message type. For example, the representative message identifier Option in the Options in the internet of things message is (9,17,1), where 9 represents a first identifier representing a protocol of an application layer, and 17 represents a second identifier representing a message type based on the application layer protocol.
The preset first identifier is a preset identifier and is a unique identifier used for distinguishing message types, and different message identifiers corresponding to different message types are used. The message identifier may be a combination of digits of 0 and 1, or 16 digits and/or letters of 0-F.
The preset second identifier is a preset identifier and is a unique identifier used for distinguishing message types, and different message identifiers corresponding to different message types. The message identification can be a combination of digits of binary 0 and 1, and also can be a combination of digits and/or letters of 16-ary 0-F. The preset first identification corresponds to at least one preset second identification.
In one embodiment, the preset first identifier is 9, and the second identifier corresponding to the preset first identifier includes 00010000, 00010001, 00010010, 00100000, 00100001, 00110000, 00110001, 01000000, 01000001, 01010000, 01010001, 01100000, 01100001, 01110000, and the like.
Specifically, the first identifier is a preset first identifier, the preset second identifier is obtained according to a corresponding relationship between the preset first identifier and the preset second identifier, and the analyzed and obtained second identifier is compared with the preset second identifier. And when the preset second identification with the same second identification does not exist, ending, and when the preset second identification with the same second identification exists, determining the message type of the Internet of things according to the second identification.
Specifically, the type of the message of the internet of things is determined according to the first identifier and the second identifier. For example, when the first message identifier is 9 and the second message identifier is 00010000, the internet of things message is an observer message; and when the first message identifier is 9 and the second message identifier is 00100000, the message of the internet of things is a Discover message.
In one embodiment, after receiving an internet of things message, a first terminal analyzes the internet of things message through an analysis packet to obtain a message identifier, wherein the message identifier includes a first identifier and a second identifier, when the first identifier in the message identifier is a preset first identifier, a preset second identifier corresponding to the first identifier is searched from a corresponding relationship between the preset first identifier and the preset second identifier according to the first identifier, and when the preset second identifier has a preset second identifier that is the same as the second identifier in the message identifier, a message type corresponding to the preset second identifier is obtained, and the type of the internet of things message is determined.
In the message type judging step of the message of the Internet of things, the message identification of the message of the Internet of things is obtained, wherein the message identification comprises a first identification and a second identification; when the first identification is a preset first identification, searching a preset second identification corresponding to the first identification from the corresponding relation between the preset first identification and the preset second identification, and if the first identification is not the preset first identification, finishing; and comparing the second identification with the preset second identification, determining the type of the message of the Internet of things according to the second identification when the preset second identification with the same second identification exists, and finishing when the preset second identification with the same second identification does not exist. Judging whether the first identification is a preset first identification, finishing judging the message type of the Internet of things when the first identification is not the preset first identification, judging the message type of the Internet of things through the first identification and the second identification, simplifying the judging process of the message type and improving the message type efficiency.
In another embodiment, as shown in fig. 4, a message processing method is provided, which is described by taking the application of the method to the first terminal 102 in fig. 1 as an example, and includes the following steps:
And step 404, analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things.
In one embodiment, the internet of things message is a CoaP message, and a message identifier in a message option of the CoaP _ GET message is obtained by analyzing a CoaP _ GET message in the CoaP message through an analysis packet. Step 406, a first identifier and a second identifier of the message identifier are obtained, where the first identifier corresponds to at least one second identifier, the first identifier is used to indicate a protocol type, and the second identifier is used to indicate a message type.
The first identifier is used for representing a protocol type, can be a Lightweight protocol (Lightweight M2M, LwM2M), is mainly used for various internet of things devices, and belongs to an application layer protocol, the architecture of the Lightweight M2M protocol is shown in fig. 5, a lower layer relies on a limited application protocol to achieve data receiving and sending, and the limited application protocol can be encrypted through a data packet transmission security protocol and finally transmitted through a user datagram protocol or a short message service mode. The messages corresponding to the lightweight M2M protocol include: observer, discover, Read, Write, Execute, Parameter, Notify messages. When the protocol is the LwM2M protocol, the first identification may be 9.
And step 408, determining the message type of the message of the internet of things according to the first identifier and the second identifier.
In one embodiment, when the first identifier is 9, that is, the protocol is the LwM2M protocol, the message type corresponding to the LwM2M protocol includes observer, discover, Read, Write, Execute, Parameter, and Notify messages, the second identifier corresponding to each message is different, and the message type of the internet of things message may be determined according to the first identifier and the second identifier.
And step 410, executing corresponding preset operation according to the message type. In the message processing method, the message of the internet of things sent by the second terminal is received; analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things, acquiring a first identifier and a second identifier of the message identifier, wherein the first identifier corresponds to at least one second identifier, the first identifier is used for representing a protocol type, the second identifier is used for representing a message type, and the message type of the message of the Internet of things is determined according to the first identifier and the second identifier; when the type of the internet of things message is judged, only the message identification in the internet of things message needs to be analyzed and obtained, the message type of the internet of things message can be determined by simply judging according to the message identification, and further complex judgment on other data carried in the internet of things message is not needed; and executing corresponding preset operation according to the message type, accurately and quickly judging the type of the message of the Internet of things according to the message identifier when receiving a plurality of messages of the Internet of things, and executing the preset operation corresponding to each message type according to the message type, thereby improving the processing efficiency and accuracy of the message of the Internet of things.
In another embodiment, as shown in fig. 6, a message processing method is provided, which is described by taking the application of the method to the second terminal 104 in fig. 1 as an example, and includes the following steps:
According to the message processing method, the second terminal obtains the message of the internet of things containing the message identifier by acquiring the message of the internet of things to be sent and adding the message identifier in the option format to the message option part of the message of the internet of things to be sent, and sends the message of the internet of things containing the message identifier to the first terminal based on the UDP protocol or in the form of SMS. By adding the message identifier in the message option of the message of the Internet of things, the message type of the message of the Internet of things can be directly judged according to the message identifier after the message of the Internet of things is analyzed, complex judgment is not needed, and the processing efficiency of the message of the Internet of things is improved.
In one embodiment, the message identifier includes a first identifier and a second identifier, the first identifier being used to indicate a protocol type, and the second identifier being used to identify a message type.
The message type of the message of the internet of things can be judged according to the message identification in the message option obtained by analyzing the message of the internet of things.
It should be understood that although the various steps in the flow diagrams of fig. 2-6 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not limited to being performed in the exact order illustrated and, unless explicitly stated herein, may be performed in other orders. Moreover, at least some of the steps in fig. 2-6 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternatingly with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 7, there is provided a message processing apparatus 700, including: a receiving module 702, a parsing module 704, a determining module 706, and an executing module 708, wherein:
A receiving module 702, configured to receive an internet of things message sent by the second terminal.
And the analyzing module 704 is configured to analyze the message of the internet of things to obtain a message identifier in the message of the internet of things.
And a determining module 706, configured to determine a message type of the internet of things message according to the message identifier.
The executing module 708 is configured to execute a corresponding preset operation according to the message type.
In the message processing device, an internet of things message sent by a second terminal is received; analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things, and determining the message type of the message of the Internet of things according to the message identifier; each message identifier corresponds to one message type, when the type of the Internet of things message is judged, only the message identifier in the Internet of things message needs to be analyzed and obtained, the message type of the Internet of things message can be determined by simply judging according to the message identifier, and further complex judgment on other data carried in the Internet of things message is not needed; and executing corresponding preset operation according to the message type, accurately and quickly judging the type of the message of the Internet of things according to the message identifier when receiving a plurality of messages of the Internet of things, and executing the preset operation corresponding to each message type according to the message type, thereby improving the processing efficiency and accuracy of the message of the Internet of things.
In an embodiment, the message processing apparatus 700 further includes an obtaining module 710, where:
the obtaining module 710 is configured to obtain a first identifier and a second identifier of a message identifier, where the first identifier corresponds to at least one second identifier, the first identifier is used to indicate a protocol type, and the second identifier is used to indicate a message type.
In one embodiment, the message processing apparatus 700 further comprises a searching module 712 and a determining module 714, wherein:
the searching module 712 is configured to search for a preset second identifier corresponding to the first identifier from a corresponding relationship between the preset first identifier and the preset second identifier.
A judging module 714, configured to compare the second identifier with a preset second identifier; and when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things.
In another embodiment, as shown in fig. 8, there is provided a message processing apparatus 800 including: an obtaining module 802, a constructing module 804, and a sending module 806, wherein:
an obtaining module 802, configured to obtain an internet of things message to be sent.
An adding module 804, configured to add a message identifier to an internet of things message to be sent, so as to obtain an internet of things message including the message identifier; the message identifier is used for determining the message type of the internet of things message to be sent.
A sending module 806, configured to send the internet of things message including the message identifier to the first terminal.
In the message processing device, the second terminal acquires the to-be-sent internet of things message, adds the message identifier in the option format to the message option part of the to-be-sent internet of things message to obtain the internet of things message containing the message identifier, and sends the internet of things message containing the message identifier to the first terminal based on the UDP protocol or in the form of SMS. By adding the message identifier in the message option of the message of the Internet of things, the message type of the message of the Internet of things can be directly judged according to the message identifier after the message of the Internet of things is analyzed, complex judgment is not needed, and the processing efficiency of the message of the Internet of things is improved.
For the specific definition of the message processing device, reference may be made to the above definition of the message processing method, which is not described in detail herein. The respective modules in the message processing apparatus described above may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 9. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a message processing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 9 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
receiving an Internet of things message sent by a second terminal;
analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
determining the message type of the message of the Internet of things according to the message identifier;
and executing corresponding preset operation according to the message type.
In one embodiment, the processor, when executing the computer program, further implements the following:
the internet of things message is a user datagram protocol based internet of things message.
In one embodiment, the processor, when executing the computer program, further implements the following:
the internet of things message based on the user datagram protocol comprises a CoaP message.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
determining the message type of the message of the Internet of things according to the message identifier, wherein the message type comprises the following steps:
acquiring a first identifier and a second identifier of a message identifier, wherein the first identifier corresponds to at least one second identifier, the first identifier is used for representing a protocol type, and the second identifier is used for representing a message type;
and determining the message type of the message of the Internet of things according to the first identifier and the second identifier.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
the first identification is a preset first identification; determining the message type of the message of the internet of things according to the first identifier and the second identifier, wherein the message type comprises the following steps:
searching a preset second identifier corresponding to the first identifier from the corresponding relation between the preset first identifier and the preset second identifier;
comparing the second identification with a preset second identification;
and when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving an Internet of things message sent by a second terminal;
Analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
determining the message type of the message of the Internet of things according to the message identifier;
and executing corresponding preset operation according to the message type.
In one embodiment, the computer program when executed by the processor further implements the following:
the internet of things message is a user datagram protocol based internet of things message.
In one embodiment, the computer program when executed by the processor further implements the following:
the internet of things message based on the user datagram protocol comprises a CoaP message.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining the message type of the message of the Internet of things according to the message identifier, wherein the message type comprises the following steps:
acquiring a first identifier and a second identifier of a message identifier, wherein the first identifier corresponds to at least one second identifier, the first identifier is used for representing a protocol type, and the second identifier is used for representing a message type;
and determining the message type of the message of the Internet of things according to the first identifier and the second identifier.
In one embodiment, the computer program when executed by the processor further performs the steps of:
the first identification is a preset first identification; determining the message type of the message of the internet of things according to the first identifier and the second identifier, wherein the message type comprises the following steps:
Searching a preset second identifier corresponding to the first identifier from the corresponding relation between the preset first identifier and the preset second identifier;
comparing the second identification with a preset second identification;
and when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring an Internet of things message to be sent;
adding a message identifier in an Internet of things message to be sent to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the internet of things message to be sent;
and sending the message of the Internet of things containing the message identifier to the first terminal.
In one embodiment, the processor, when executing the computer program, further implements the following:
the message identifier comprises a first identifier and a second identifier, wherein the first identifier is used for indicating the protocol type, and the second identifier is used for indicating the message type.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
Acquiring an Internet of things message to be sent;
adding a message identifier in an Internet of things message to be sent to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the internet of things message to be sent;
and sending the message of the Internet of things containing the message identifier to the first terminal.
In one embodiment, the computer program when executed by the processor further implements the following:
the message identifier comprises a first identifier and a second identifier, wherein the first identifier is used for indicating the protocol type, and the second identifier is used for indicating the message type.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
All possible combinations of the technical features in the above embodiments may not be described for the sake of brevity, but should be considered as being within the scope of the present disclosure as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is specific and detailed, but not to be understood as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, and these are all within the scope of protection of the present application. Therefore, the protection scope of the present patent application shall be subject to the appended claims.
Claims (10)
1. A message processing method applied to a first terminal is characterized by comprising the following steps:
receiving an internet of things message sent by a second terminal;
analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things; the message of the Internet of things comprises a message header, wherein the message header comprises a message Option, the message Option comprises a plurality of options, and each Option comprises a first identifier representing a protocol type and a second identifier representing a message type;
When the first identification is a preset first identification, searching a preset second identification corresponding to the first identification from the corresponding relation between the preset first identification and the preset second identification;
comparing the second identifier with the preset second identifier;
when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things;
executing corresponding preset operation according to the message type; wherein, different message types correspond to different types of preset operations.
2. The method of claim 1, wherein the internet of things message is a user datagram protocol based internet of things message.
3. The method of claim 2, wherein the user datagram protocol based internet of things message comprises a CoaP message.
4. A message processing method, applied to a second terminal, the method comprising:
acquiring an Internet of things message to be sent;
adding a message identifier in the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message of the internet of things comprises a message header, wherein the message header comprises a message Option, the message Option comprises a plurality of options, and each Option comprises a first identifier representing a protocol type and a second identifier representing a message type;
When the first identification is a preset first identification, searching a preset second identification corresponding to the first identification from the corresponding relation between the preset first identification and the preset second identification;
comparing the second identifier with the preset second identifier;
when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things; and sending the Internet of things message containing the message identifier to the first terminal.
5. A message processing apparatus, characterized in that the apparatus comprises:
the receiving module is used for receiving the Internet of things message sent by the second terminal;
the analysis module is used for analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things; the message of the internet of things comprises a message header, wherein the message header comprises a message Option, the message Option comprises a plurality of options, and each Option comprises a first identifier representing a protocol type and a second identifier representing a message type;
the searching module is used for searching a preset second identifier corresponding to the first identifier from the corresponding relation between the preset first identifier and the preset second identifier when the first identifier is the preset first identifier;
The judging module is used for comparing the second identifier with the preset second identifier; when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things;
the execution module is used for executing corresponding preset operation according to the message type; wherein, different message types correspond to different types of preset operations.
6. The apparatus of claim 5, wherein the IOT message is a user datagram protocol based IOT message.
7. The apparatus of claim 6, wherein the user datagram protocol based internet of things message comprises a CoaP message.
8. A message processing apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring the message of the Internet of things to be sent;
the adding module is used for adding a message identifier into the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message of the internet of things comprises a message header, wherein the message header comprises a message Option, the message Option comprises a plurality of options, and each Option comprises a first identifier representing a protocol type and a second identifier representing a message type;
When the first identification is a preset first identification, searching a preset second identification corresponding to the first identification from the corresponding relation between the preset first identification and the preset second identification;
comparing the second identifier with the preset second identifier;
when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things;
and the sending module is used for sending the message of the internet of things containing the message identifier to the first terminal.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor when executing the computer program implements the steps of the method of any one of claims 1 to 4.
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 of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910911094.0A CN110808950B (en) | 2019-09-25 | 2019-09-25 | Message processing method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910911094.0A CN110808950B (en) | 2019-09-25 | 2019-09-25 | Message processing method, device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110808950A CN110808950A (en) | 2020-02-18 |
CN110808950B true CN110808950B (en) | 2022-06-28 |
Family
ID=69487869
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910911094.0A Active CN110808950B (en) | 2019-09-25 | 2019-09-25 | Message processing method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110808950B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112468485A (en) * | 2020-11-24 | 2021-03-09 | 广东电力信息科技有限公司 | Internet of things message processing method, device, terminal and storage medium |
CN114979308B (en) * | 2022-05-11 | 2024-04-16 | 北京沃东天骏信息技术有限公司 | Message processing method and device |
CN115633187B (en) * | 2022-12-22 | 2023-04-07 | 易方信息科技股份有限公司 | Chat message processing method and device, computer equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2012167659A1 (en) * | 2011-07-14 | 2012-12-13 | 华为技术有限公司 | Data communication method and device in constrained application protocol |
CN103795689A (en) * | 2012-10-29 | 2014-05-14 | 中兴通讯股份有限公司 | Resource subscription method and device |
CN105075224A (en) * | 2013-02-08 | 2015-11-18 | 交互数字专利控股公司 | Method and apparatus for incorporating an internet of things (IoT) service interface protocol layer in a node |
CN109996304A (en) * | 2018-01-02 | 2019-07-09 | ***通信有限公司研究院 | A kind of Internet of Things method for switching network and device |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103796300A (en) * | 2012-10-29 | 2014-05-14 | 中兴通讯股份有限公司 | Terminal peripheral logout method and device in machine type communication system and gateway |
CN106209812A (en) * | 2016-07-04 | 2016-12-07 | 深圳市得润车联科技有限公司 | A kind of method of internet-of-things terminal platform data encapsulation |
CN107070719B (en) * | 2017-04-24 | 2019-12-06 | 新华三信息技术有限公司 | Equipment management method and device |
KR20190064346A (en) * | 2017-11-30 | 2019-06-10 | 동국대학교 산학협력단 | System for transmitting push message |
CN110113730A (en) * | 2019-03-22 | 2019-08-09 | 深圳市广和通无线股份有限公司 | Method for network access, device, Internet of Things module and storage medium |
-
2019
- 2019-09-25 CN CN201910911094.0A patent/CN110808950B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2012167659A1 (en) * | 2011-07-14 | 2012-12-13 | 华为技术有限公司 | Data communication method and device in constrained application protocol |
CN103795689A (en) * | 2012-10-29 | 2014-05-14 | 中兴通讯股份有限公司 | Resource subscription method and device |
CN105075224A (en) * | 2013-02-08 | 2015-11-18 | 交互数字专利控股公司 | Method and apparatus for incorporating an internet of things (IoT) service interface protocol layer in a node |
CN109996304A (en) * | 2018-01-02 | 2019-07-09 | ***通信有限公司研究院 | A kind of Internet of Things method for switching network and device |
Also Published As
Publication number | Publication date |
---|---|
CN110808950A (en) | 2020-02-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110808950B (en) | Message processing method, device, computer equipment and storage medium | |
CN107612909B (en) | Information interaction method, device and equipment about Internet of things equipment | |
US20160253664A1 (en) | Attestation by proxy | |
WO2021083083A1 (en) | Upgrading method and system, server, and terminal device | |
CN106878108B (en) | Network flow playback test method and device | |
CN110891005A (en) | IOT equipment control method, cloud server and IOT equipment control system | |
CN109787974B (en) | Message data stream generation method and device, computer equipment and storage medium | |
CN108897728B (en) | Short message splicing processing method and device, computer equipment and storage medium | |
CN104580112B (en) | A kind of service authentication method, system and server | |
CN111683066A (en) | Heterogeneous system integration method and device, computer equipment and storage medium | |
CN108418797B (en) | Webpage access method and device, computer equipment and storage medium | |
CN112631924A (en) | Automatic testing method and device, computer equipment and storage medium | |
KR101559059B1 (en) | Method for M2M application service and device therefor | |
CN111147586B (en) | Equipment end control method and device and conference system | |
CN111367923A (en) | Data processing method, data processing device, node equipment and storage medium | |
CN111552696A (en) | Data processing method and device based on big data, computer equipment and medium | |
CN108833500B (en) | Service calling method, service providing method, data transmission method and server | |
US20190129907A1 (en) | Data transfer system, data transfer apparatus, data transfer method, and computer-readable recording medium | |
CN110930193B (en) | Advertisement conversion rate evaluation method, advertisement conversion rate evaluation device, computer equipment and storage medium | |
CN114338527B (en) | IPv6 active identifier processing method and system | |
CN115982735A (en) | Method, device and storage medium for automatically processing production data | |
CN112464259B (en) | ERP page acquisition method, ERP page acquisition device, computer equipment and storage medium | |
CN114615325A (en) | Message pushing method and device, computer equipment and storage medium | |
CN113706131A (en) | Block chain transaction method, device and equipment based on encryption card | |
CN108966154B (en) | Method and device for sending short messages in group, computer equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |